Creates a StoredChannelTransfer — a channel that stores the last value with external management.
Capabilities: Pullable, Subscribable, Triggerable
— configuration (setup, destroy, initialValue, onError handlers)
const channel = createStoredChannelTransfer<number>({ setup: (emit) => { const ws = new WebSocket('ws://example.com'); ws.onmessage = (e) => emit(JSON.parse(e.data)); }, destroy: () => ws.close()});console.log(channel.pull()); // last valuechannel.subscribe(x => console.log(x)); Copy
const channel = createStoredChannelTransfer<number>({ setup: (emit) => { const ws = new WebSocket('ws://example.com'); ws.onmessage = (e) => emit(JSON.parse(e.data)); }, destroy: () => ws.close()});console.log(channel.pull()); // last valuechannel.subscribe(x => console.log(x));
Creates a StoredChannelTransfer — a channel that stores the last value with external management.
Capabilities: Pullable, Subscribable, Triggerable