@erickmerchant/context-store

1.0.1 • Public • Published

@erickmerchant/context-store

Creates a store to be used with combine-stores.

const framework = require('@erickmerchant/framework')

const combineStores = require('@erickmerchant/combine-stores')

const contextStore = require('@erickmerchant/context-store')

const store = combineStores(function (store) {
  store('context', contextStore(['', 'create', 'edit/:id']))
})

const component = require('./components/index')

const target = document.querySelector('main')

const diff = require('yo-yo').update

framework({target, store, component, diff})(init)

function init ({dispatch}) {
  const history = require('./history')

  history.listen(function (location) {
    dispatch('context', location.pathname)
  })

  dispatch('context', history.location.pathname)
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i @erickmerchant/context-store

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • erickmerchant