The global scope in the browser is actually a window object, so if your variable is a global variable, it is actually bound to the window object. That way you can access it as window.variableName just like just variableName . And so you should be able to say:
window.watch('variableName', callback);
source share