1.0.5 • Published 5 years ago
the-space v1.0.5
the-space
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.