- Notifications
You must be signed in to change notification settings - Fork6
State containers with dirty checking and more
License
wix-incubator/mutable
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Mutable state containers in javascript with dirty checking and more (WIP)
Mutable is amobx-compatible class system library. Mutable offers a unique runtime schema engine that enforcesunidirectional data flow,and formalizes the structure of props and state.Mutable also supports data defaults, and non-nullable types.
Add Mutable to your project by installing it withnpm:
npm install mutable --save
Simple code example:
import*asmutablefrom'mutable';import*asmobxfrom'mutable';// define a mutable class by providing a name and a spec (class schema)constDude=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 constructorconstdude=newDude({name:'Ido'});mobx.autorun(function(){console.log(dude.name+' '+dude.age);});// prints: Leon 110dude.name='Mike';// prints: Mike 110
Integrating mutable into React components is up to the user.
Clone this project locally.Then, at the root folder of the project, run:
npm installnpmtestAt the root folder of the project, run:
npm start
Then, open your browser athttp://localhost:8080/webtest.bundleand see any changes you make in tests or code reflected in the browser
Currently Mutable is in alpha mode. As such, it does not respect semver.
We use a custom license, seeLICENSE.md
These are examples of the kinds of libraries we would like to model ourselves after.
- NestedTypes : High-performance model framework, which can be used as drop-in backbonejs replacement.
- mobx : Simple, scalable state management
- alt : A library that facilitates the managing of state within your JavaScript applications. It is modeled after flux.
- immutable.js : Immutable persistent data collections for Javascript which increase efficiency and simplicity
- cls.js : Easy, dynamic (kind of mixin) javascript classes
- observable-value: Object representation of mutable value
About
State containers with dirty checking and more
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors14
Uh oh!
There was an error while loading.Please reload this page.