4.0.2 • Published 7 years ago

@erickmerchant/state-container v4.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
7 years ago

@erickmerchant/state-container

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/state-container')

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.
4.0.2

7 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.2.0

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago