cycle-snabbdom
cycle-snabbdom copied to clipboard
Access snabbdom-to-html modules when using makeHTMLDriver
Overview
Add modules option for makeHTMLDriver
import Rx from 'rx'
-import toHTML from 'snabbdom-to-html'
+import init from from 'snabbdom-to-html/init'
+import AttrsModule from 'snabbdom-to-html/modules/attributes'
+import StyeModule from 'snabbdom-to-html/modules/style'
import {transposeVTree} from './transposition'
function makeBogusSelect() {
return function select() {
return {
observable: Rx.Observable.empty(),
events() {
return Rx.Observable.empty()
},
}
}
}
+const defaultModules = [
+ AttrsModules, StyleModule,
+]
-function makeHTMLDriver() {
+function makeHTMLDriver({modules = defaultModules} = {modules: defaultModules})
+ const toHTML = init(modules)
return function htmlDriver(vtree$) {
let output$ = vtree$.flatMapLatest(transposeVTree).last().map(toHTML)
output$.select = makeBogusSelect()
return output$
}
}
export {makeHTMLDriver}
Also need to add something to the documentation for this