@motorcycle/html

1.1.3 • Public • Published

Motorcycle HTML Driver Build Status Motorcycle.js

This is the standard HTML driver for Motorcycle built using snabbdom-to-html.

Installing

$ npm install @motorcycle/html

Want to Contribute?

If you found an issue or want to contribute code, please read the contributing guidelines.

Example Usage

import {run} from '@motorcycle/core'
import {h2} from '@motorcycle/dom'
import htmlDriver from '@motorcycle/html'

function app(sources) {
  ...
  return {
    HTML: most.just(h2('Hello, world!'))
  }
}

const {sources} = run(app, {
  HTML: htmlDriver,
})

sources.HTML.select(':root').observable.observe(html => {...})

API

htmlDriver(source$)

htmlDriver is a function which takes a stream of Snabbdom virtual nodes and returns a stream of HTML strings.

Arguments

source$ :: most.Stream - A stream of Snabbdom virtual nodes.

Returns

(Object): An object with a single method select().

select() :: Function - A function which return as an object containing observable and events().

observable :: most.Stream - A stream of HTML strings.

events() :: Function - A function which returns an empty stream for compatibility with the DOM driver API.

Package Sidebar

Install

npm i @motorcycle/html

Weekly Downloads

1

Version

1.1.3

License

MIT

Last publish

Collaborators

  • tylors
  • motorcyclets
  • frikki