web-worker-helper
Version:
Utilities for running tasks on worker threads
24 lines (23 loc) • 1.07 kB
JavaScript
;
// Purpose: include this in your module to avoids adding dependencies on
// micro modules like 'global' and 'is-browser';
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMobile = exports.isWorker = exports.document = exports.global = exports.window = exports.self = void 0;
/* 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 || {};
exports.self = self_;
var window_ = globals.window || globals.self || {};
exports.window = window_;
var global_ = globals.self || globals.window || {};
exports.global = global_;
var document_ = globals.document || {};
exports.document = document_;
/** true if running on a worker thread */
exports.isWorker = typeof importScripts === 'function';
/** true if running on a mobile device */
exports.isMobile = typeof window !== 'undefined' && typeof window.orientation !== 'undefined';