loveuer 244e749f54
Some checks failed
/ build ushare (push) Failing after 12s
/ clean (push) Successful in 0s
feat:
1. local msg/file share by webrtc
fix:
  1. meta clean goroutine walk error
  2. clean interval to args(--clean)
2025-06-23 23:03:27 +08:00

24 lines
581 B
TypeScript

import {create} from 'zustand'
export interface LocalStore {
id: string;
name: string;
channel?: RTCDataChannel;
set: (id: string, name: string) => void;
setChannel: (chan?: RTCDataChannel) => void;
}
export const useLocalStore = create<LocalStore>()((_set, get) => ({
id: '',
name: '',
set: (id: string, name: string) => {
_set(state => {
return {...state, id: id, name: name};
})
},
setChannel: (ch?: RTCDataChannel) => {
_set(state => {
return {...state, channel: ch}
})
}
}))