0.1.10 • Published 4 years ago
plo v0.1.10
PLO
Plain Javascript Object State Container
Install
npm i plo
Example
Define Object with state, getter and setter. Subscribe the model and just use it.
import { createModel } from 'plo'
const [helloModel, helloSubscribe] = createModel({
state: ['hello'],
addState(state) {
this.state.push(state)
},
getState() {
return this.state.join(' ')
},
})
helloSubscribe(model => {
console.log(model.getState())
})
helloModel.addState('world')
How
Only methods that start with "get" do not publish the model