Watch.JS icon indicating copy to clipboard operation
Watch.JS copied to clipboard

npm watch.js is out of date, silently breaks on examples

Open mikemaccana opened this issue 12 years ago • 3 comments

The following example is taken directly from the current watch.js docs:

var WatchJS = require("watchjs")

//defining our object no matter which way we want
var ex = {
  l1a: "bla bla",
  l1b: {
    l2a: "lo lo",
    l2b: "hey hey"
  }
};

WatchJS.watch(ex, function (prop, action, difference, oldvalue){
  console.log("prop: "+prop+"\n action: "+action+"\n difference: "+JSON.stringify(difference)+"\n old: "+JSON.stringify(oldvalue)+"\n ... and the context: "+JSON.stringify(this));
}, 0, true);


ex.l1b.l2c = "new attr"; //it is not instantaneous, you may wait 50 miliseconds

setTimeout(function(){
  ex.l1b.l2c = "other value";
}, 100);

This will silently fail on watch.js as implemented on npm. Replacing node_modules/src/watch.js with the current one from github will fix the issue.

I can reproduce this on demand if needed BTW.

mikemaccana avatar Aug 16 '13 15:08 mikemaccana

well the WatchJS of the npm is outdated, someone else is the maintaner and I have no control =/ I've already asked to be added as mainteiner, do you know how I could fix this?

melanke avatar Sep 11 '13 14:09 melanke

Both the version on NPM and the version in this repo are silently failing on Node for me, using the above example.

I'm using Node v0.10.26.

gdude2002 avatar Mar 04 '14 13:03 gdude2002

The 'watchjs' uploaded to npm is maintained by Matt Bell (@mappum) - Matt could you please transfer the package to Gil (@melanke) ?

mikemaccana avatar Mar 05 '14 12:03 mikemaccana