npm.io
1.0.1 • Published 9 years ago

ohen

Licence
MIT
Version
1.0.1
Deps
0
Vulns
0
Weekly
0
Stars
1

Ohen

Ohen makes objects observable using dirty checking.

Last version Build Status Greenkeeper badge Dev Dependencies Status NPM Status

Installation

$ npm install ohen --save

Preview

import Ohen from 'ohen';

const person = {
  name: 'Eragon',
  dragon: 'Saphira',
};

Ohen.observe(person, changes => {
  console.log(`@person: ${changes}`));
}, ['add', 'update', 'delete']);

person.father = 'Brom';
// @person: { "name": "name", "type": "update", "object": Object, "oldValue": "Eragon" }

person.name = 'Argetlam';
// @person: { "name": "father", "type": "add", "object": Object }

delete person.father;
// @person: { "name": "father", "type": "delete", "object": Object, "oldValue": "Brom" }

License

MIT Rubén Moya