Mutable state containers with dirty checking and more
npm install mutableMutable state containers in javascript with dirty checking and more (WIP)
``bash`
npm install mutable --save
Simple code example:
`es6
import * as mutable from 'mutable';
import * as mobx from 'mutable';
// define a mutable class by providing a name and a spec (class schema)
const Dude = mutable.define('Dude', {
spec: ()=>({
name: Mutable.String.withDefault('Leon'),
age: Mutable.Number.withDefault(110),
address: Mutable.String.withDefault('no address')
})
});
// Mutable types accept custom data according to their spec as the first argument of their constructor
const dude = new Dude({name:'Ido'});
mobx.autorun(function () {
console.log(dude.name + ' ' + dude.age);
});
// prints: Leon 110
dude.name = 'Mike';
// prints: Mike 110
`
Integrating mutable into React components is up to the user.
shell
npm install
npm test
`
$3
At the root folder of the project, run:
`shell
npm start
`
Then, open your browser at http://localhost:8080/webtest.bundle
and see any changes you make in tests or code reflected in the browser$3
Currently Mutable is in alpha mode. As such, it does not respect semver.$3
We use a custom license, see `LICENSE.md``