state-singleton
v1.0.1
Published
Javascript observable state container
Downloads
4
Maintainers
Readme
state-singleton
Javascript observable state container
Getting Started
1. Installation
npm install state-singleton
2. Examples
state.set('prop', {a: 1})
// triggered whenever the entity is changed
state.on('prop', function(newValue, oldValue) {
test.deepEqual(newValue, {a: 2}, 'new value was not expected');
test.deepEqual(oldValue, {a: 1}, 'old value was not expected');
test.done();
})
state.set('prop', {a: 2});
state.get('prop') // returns {a: 2}
Copyright and license
Copyright (c) 2015, Any Code [email protected]
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.