@act/ws 中文文档教程
Act ws
Act ws hello world:
import main from '@act/main'
import fromSocket from '@act/ws/fromSocket'
const socket = fromSocket('ws://socket-server.com')
const view = (model) =>
['main', [
['button', { click: socket.emit('ping') }, 'Ping']
model
]]
const subscriptions = { pong: socket.on('pong') }
main(view, { model: 'No pong yet', subscriptions })
More
此模块的文档是 Act 的的一部分 文档。
A simple reactive front-end framework
Act ws
Act ws hello world:
import main from '@act/main'
import fromSocket from '@act/ws/fromSocket'
const socket = fromSocket('ws://socket-server.com')
const view = (model) =>
['main', [
['button', { click: socket.emit('ping') }, 'Ping']
model
]]
const subscriptions = { pong: socket.on('pong') }
main(view, { model: 'No pong yet', subscriptions })
More
The documentation for this module is part of Act's docs.