JSPM

@motorcycle/html

1.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q15043F
  • License MIT

Motorcycle.js HTML Driver

Package Exports

  • @motorcycle/html

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@motorcycle/html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.