This package has been deprecated

Author message:

move to @the-/scope ( https://github.com/the-labo/the/tree/master/packages/scope#readme )

the-scope

3.1.0 • Public • Published

the-scope

Build Status npm Version JS Standard

State scope for the-store

Installation

$ npm install the-scope --save

Usage

'use strict'

const {TheScope} = require('the-scope')
const {TheStore} = require('the-store')

async function tryExample () {
  class FlgScope extends TheScope {
    static get initialState () {
      return false
    }

    static get reducerFactories () {
      return {
        toggle (value) {
          return (state) => typeof value === 'undefined' ? !state : value
        }
      }
    }
  }

  const store = new TheStore()
  store.load(FlgScope, 'flg')
  store.flg.toggle(true)
  console.log(store.flg.state) // -> true
}

tryExample().catch((err) => console.error(err))

API Guide

License

This software is released under the MIT License.

Links

Readme

Keywords

Package Sidebar

Install

npm i the-scope

Weekly Downloads

55

Version

3.1.0

License

MIT

Unpacked Size

270 kB

Total Files

89

Last publish

Collaborators

  • okunishinishi