Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access snabbdom-to-html modules when using makeHTMLDriver #11

Open
TylorS opened this issue Feb 1, 2016 · 1 comment
Open

Access snabbdom-to-html modules when using makeHTMLDriver #11

TylorS opened this issue Feb 1, 2016 · 1 comment

Comments

@TylorS
Copy link
Owner

TylorS commented Feb 1, 2016

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}
@TylorS
Copy link
Owner Author

TylorS commented Feb 1, 2016

Also need to add something to the documentation for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant