JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28
  • Score
    100M100P100Q69739F
  • License ISC

Package Exports

  • async-watch

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 (async-watch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status

async-watch

AsyncWatch is a small library for watching javascript/node.js objects. It is using Object.defineProperty which makes it compatible with most browsers.

Features

  • Asynchronous execution (trigges changes on animationFrame)
  • Nested object watching
  • Restoring watchers after an object is destroyed

Install

For browser:

bower install async-watch --save

For Node.js projects

npm install async-watch --save

Examples

var watch = require('async-watch').AsyncWatch; // not needed for browsers
var obj = {}; // creating an empty object
AsyncWatch(obj, 'a.b.c', function(value){
    console.log(value);
});

As you can see here, we start with an empty object. AsyncWatch will set a watcher on property "a", which knows about its descendands

 obj.a = {
  b : {
   c : 1
  }
 };
 obj.a.b.c = 2;
 obj.a.b.c = 3;