hg-event-router

1.0.0 • Public • Published

Mercury EventHashRouter

This module attaches HashRouter to the mercury Event Loop system so that when the hash location changes an event is triggered in mecury to modify state and re-render:

example:

var EventRouter = require('hg-event-router');
var state = hg.state({
  title: hg.value('Foo - Home'),
  route: hg.value('#/'),
  events: {
    setRoute: EventRouter()
  }
});
state.events.setRoute(EventRouter.update.bind(null, state));

hg.app(document.body, state, render);  

install:

npm install hg-hash-router

/hg-event-router/

    Package Sidebar

    Install

    npm i hg-event-router

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • twilson63