is-web-worker
Determines if the code is running with a Web Worker.
isWebWorker()
var isWebWorker = require("can-util/js/is-web-worker/is-web-worker");
var GLOBAL = require("can-globals/global/global");
if(isWebWorker()) {
console.log(GLOBAL() === self); // -> true
}
Returns
{Boolean}
:
True if running in a Web Worker.