How to break on LocalStorage changes

If you’re debugging a LocalStorage issue and want to use a call stack to know what or who is triggering a localstorage get or set you can define a proxy function. The following snippet will overwrite the window.localStorage It has the same functions but adds a console.log and debugger before them.