Not working in worker context
If you load the script in worker thread, it will throw error: Uncaught ReferenceError: window is not defined
The problematic code is: var g = typeof GLOBAL !== 'undefined' ? GLOBAL : window;
Better to change it to: var g = typeof GLOBAL !== 'undefined' ? GLOBAL : self;