@erickmerchant/combine-stores

3.0.3 • Public • Published

@erickmerchant/combine-stores

Meant to be used with @erickmerchant/framework, it can be used to construct a store that's easy to organize. It defines a state that is an object and each store that you define handles a single property on that object.

/* an example */

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

/* here is the relevant stuff */

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

const store = container(function (define) {
  define('errors', require('./stores/errors'))
  define('fetchingCount', require('./stores/fetching-count'))
  define('tasks', require('./stores/tasks'))
})

/* end relevant */

const component = require('./component.js')

const target = document.querySelector('main')

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

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

API Reference

container

container((define) => { ... })

The function exported by this module.

define

define(property, store)

  • property: the property that the store will handle
  • store: a store. When it is called it is only passed the property that it handles as the first argument. When called with no arguments it should return the default for that property.

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i @erickmerchant/combine-stores

    Weekly Downloads

    1

    Version

    3.0.3

    License

    ISC

    Last publish

    Collaborators

    • erickmerchant