Closed bloodcarter closed 7 years ago
Do you have a working example that generates this error?
This, for instance
'use strict';
var logger = require("./logger");
var WatchJS = require("watchjs")
var watch = WatchJS.watch;
var unwatch = WatchJS.unwatch;
var callWatchers = WatchJS.callWatchers;
var x = 0;
watch(x, function(prop, action, newvalue, oldvalue){
//logger.error('%s has changed', prop);
// WatchJS.noMore = true;
console.log("trigger!");
}, 2, false);
x = 2;
x must have a parent object:
var parent = { x: 0};
watch(parent, "x", function(prop, action, newvalue, oldvalue){
//logger.error('%s has changed', prop);
// WatchJS.noMore = true;
console.log("trigger!");
}, 2, false);
parent.x = 2;
@melanke Does that mean that I cannot pass this to the watch function? What should I do in order to use it inside an object?
1) When not specifying level and set new objects = true got Maximum call stack size exceeded. 2) If doing this, no changes catch at all: