saphir

0.2.1 • Public • Published

Saphir Build Status Coverage Status

A small library that helps to observe defined Object/Array properties.

npm install saphir
# or 
bower install saphir
var observableObj = new SaphirObject(
  {a: 'foo'}
);
 
observableObj._subscribe('a', function(newValue, oldValue) {
  console.log(oldValue + ' => ' + newValue);
});
 
observableObj.a = 'bar';
// foo => bar
 
var observableArr = new SaphirArray([1, 3, 2]);
 
observableArr._subscribe(function(newValue) {
  console.log(newValue);
});
 
observableArr[0] = 4;
// [4, 3, 2]
observableArr.push(1);
// [4, 2, 3, 1]

TODO

  • multi subscription
  • more benchmarks

/saphir/

    Package Sidebar

    Install

    npm i saphir

    Weekly Downloads

    2

    Version

    0.2.1

    License

    MIT

    Last publish

    Collaborators

    • tameraydin