state-singleton

1.0.1 • Public • Published

state-singleton

Build Status

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 lee@anycode.io

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.

Package Sidebar

Install

npm i state-singleton

Weekly Downloads

4

Version

1.0.1

License

ISC

Last publish

Collaborators

  • qrb