Break on a change of variable value

前端 未结 3 1957
一向
一向 2020-11-28 10:55

Similar to other questions here, like this one.

Is there a way to break on the change of a variable value in any JavaScript debugger? (like IE Developer tools, Visua

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 11:24

    I'm having success with this library in Chrome and it looks to support all major browsers.

    https://gist.github.com/eligrey/384583

    Just include the .js file, then call:

    yourObject.watch('someProperty', function() { 
        doWhatYouWant(); 
        debugger; 
        console.write('this too'); 
        alert('Object Changed'); //etc 
    });
    

提交回复
热议问题