Static Create Method - PronabM/State.js GitHub Wiki

Static Create

Takes a simple JavaScript Object and make it observable. This returns the new object as a state instance which can be used to observe property change.

State.create() uses the Static create function that takes the object description as function argument and creates an observable object which is defined later.

let myState = State.create({ 
    range: {
        start: 1,
        end: 5 
    },
    visible: true 
});

This is the definition of the proposed observable object that contains the member functions and the object description is stored in the core.

> myState;
{
core:{range: {…}, visible: true}
create:ƒ(property,opt)
eventList:{range.start: ƒ}
getState:ƒ()
isLocked:false
lock:ƒ()
off:ƒ(propt)
on:ƒ(propt,handle)
prop:ƒ(property,value)
unlock:ƒ()
}