Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome debugger break on global change? #126

Open
scripting opened this issue Aug 21, 2019 · 1 comment

Comments

@scripting
Copy link
Owner

commented Aug 21, 2019

Is there a way in the Chrome JavaScript debugger to set a breakpoint when the value of a global changes? I have a global say myGlobals.val. It's initialized when the app starts, but when it's used it's got a different value. I want to stop at the line that changes its value.

@kimhornung

This comment has been minimized.

Copy link

commented Aug 21, 2019

According to the following stackoverflow article, you can use Object.defineProperty to assign a custom setter function. And the put your breakpoint in that function.

https://stackoverflow.com/questions/13291814/chrome-javascript-debugging-how-to-break-when-a-value-changes/13291928#13291928

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.