color-scheme-js
color-scheme-js copied to clipboard
Use self instead of window to support Web Workers
Thanks for this library! I'd like to use it for a project that is using Web Workers. However, currently, it throws an error when it is loaded due to a reference to window
, which isn't available in a Web Worker. Replacing this with self
, which is available in both the main browser thread and Web Workers, fixes the issue and the library works perfectly!