本文整理匯總了TypeScript中dompteuse.StreamSub類的典型用法代碼示例。如果您正苦於以下問題:TypeScript StreamSub類的具體用法?TypeScript StreamSub怎麽用?TypeScript StreamSub使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了StreamSub類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: connect
function connect(on: StreamSub<State>, events: Events) {
on(events.listen('button', 'click'), state => {
const opened = !state.opened
if (opened) events.emit(Opened())
return merge(state, { opened })
})
}
示例2: connect
function connect(on: StreamSub<State>, events: Events) {
const formUpdate = events.listen('input', 'input').map(evt => {
const { name, value } = evt.target as HTMLInputElement
return { [name]: value.substr(0, 4) }
})
on(formUpdate, (state, patch) =>
update(state, { form: patch })
)
on(appState, (state, appState) =>
merge(state, { id: appState.route.params['id'] })
)
on(events.listen('.red', Opened), (state, _) =>
merge(state, { redText: state.redText + ' Opened!' })
)
}
示例3: connect
function connect(on: StreamSub<State>, events: Events) {
events.listen('.increment button', 'click').forEach(_ => appState.emit(incrementBlue()))
on(appState, readGlobalState)
}
示例4: connect
function connect(on: StreamSub<State>) {
on(appState, readGlobalState)
}