Removed window reference in library to enable usage with web workers

Just changing the way the library is globally available by removing `window` reference during initialization. My use case required me to offload some text processing to web workers which is a fairly common thing these days wherein large text is processed asynchronously.   By removing the reference to `window`, this library can be used with web workers or any other context that breaks when the `DOM` is referenced.