JSPM

  • Created
  • Published
  • Downloads 615
  • Score
    100M100P100Q99600F
  • License MIT

Control state of any object

Package Exports

  • st8

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (st8) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm install st8
var state = require('st8');

//target can be any object
var target = {};

//apply properties controller to the target
state(target, {
    a: {
        init: function(){
            return 1
        },
        changed: function(v){
            assert.equal(v, 2)
        }
    },

    b: {
        _: {
            a: {
                set: function(v){
                    assert.equal(v,1)
                    return 2;
                }
            }
        }
    }
});

assert.equal(target.a, 2);

TODO

  • replace set of storages with property class. It seems to be good idea.
  • extern muparse, mustring
  • move actual tests from mod here