createEvent(name?)
Creates an event
Arguments
name
? (string): Event name
Returns
(Event
): An intention to change state.
Example
const event = createEvent() // unnamed event
const onMessage = createEvent('message')
const socket = new WebSocket('wss://example.com:4000')
socket.onmessage = msg => onMessage(msg)
const data = onMessage.map(msg => msg.data).map(JSON.parse)
// Handle side effects
data.watch(console.log)