15.4.14 • Published 3 years ago

@the-/scope v15.4.14

Weekly downloads
444
License
MIT
Repository
github
Last release
3 years ago

@the-/scope

npm Version

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

See API Guide for more detail

License

This software is released under the MIT License.

Links

15.4.14

3 years ago

15.4.13

4 years ago

15.4.9

5 years ago

15.4.3

5 years ago

15.4.1

5 years ago

15.2.4

5 years ago

15.2.3

5 years ago

15.2.0

5 years ago

15.1.4

5 years ago

15.1.3

5 years ago

15.1.2

5 years ago

15.1.0

5 years ago

15.0.4

5 years ago

15.0.3

5 years ago

15.0.2

5 years ago