UNPKG

web-worker-helper

Version:

Utilities for running tasks on worker threads

18 lines (17 loc) 865 B
// Purpose: include this in your module to avoids adding dependencies on // micro modules like 'global' and 'is-browser'; /* eslint-disable no-restricted-globals */ var globals = { self: typeof self !== 'undefined' && self, window: typeof window !== 'undefined' && window, document: typeof document !== 'undefined' && document, }; var self_ = globals.self || globals.window || {}; var window_ = globals.window || globals.self || {}; var global_ = globals.self || globals.window || {}; var document_ = globals.document || {}; export { self_ as self, window_ as window, global_ as global, document_ as document }; /** true if running on a worker thread */ export var isWorker = typeof importScripts === 'function'; /** true if running on a mobile device */ export var isMobile = typeof window !== 'undefined' && typeof window.orientation !== 'undefined';