I am using the object.watch method.

    obj[i].position.watch("x", function (id, oldval, newval) {
        console.log( "Object " + id + " changed from " + oldval + " to " + newval );
        return newval;
    });

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FObject%2Fwatch#Examples

How do I find out, where in my code(which .js file, which line) this value is getting changed?

有帮助吗?

解决方案

Try adding the line debugger; and inspect the call stack - or just simply set a breakpoint on the console.log() line.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top