質問

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