1.0.5 • Published 5 years ago

the-space v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

the-space

Build Status npm Version JS Standard

Store space of the-compopnents

Installation

$ npm install the-space --save

Usage

'use strict'

const { TheSpace } = require('the-space')
const { TheState } = require('the-state')

async function tryExample () {
  const state = new TheState({})
  const rootSpace = new TheSpace.Root({ shared: { state }, })

  {
    class SignUpSpace extends TheSpace {
      get scope () {
        return this.shared.state.scope('account.create')
      }

      get scopeDefaults () {
        return { entry: {} }
      }

      async submit () {
        /** ... */
      }
    }
  }

  {
    const accountCreateSpace = rootSpace.load(SignUpSpace, 'signUpSpace')
    accountCreateSpace.set({
      entry: { name: 'user01', password: 'xxxx' }
    })
    await accountCreateSpace.submit()

  }
}

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

API Guide

License

This software is released under the MIT License.

Links

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.0

5 years ago