Use either the window object in the browser or the global object in node.
github.com/purposeindustries/window-or-global
purposeindustries/window-or-global