feat: support for Web Worker env issue #124

This commit is contained in:
Zongmin Lei
2018-05-24 15:49:29 +08:00
parent 89d83019a9
commit 58d1140d20
6 changed files with 64 additions and 1 deletions

8
dist/xss.js vendored
View File

@@ -448,6 +448,14 @@ if (typeof window !== "undefined") {
window.filterXSS = module.exports;
}
// using `xss` on the WebWorker, output `filterXSS` to the globals
function isWorkerEnv() {
return typeof self !== 'undefined' && self instanceof DedicatedWorkerGlobalScope;
}
if (isWorkerEnv()) {
self.filterXSS = module.exports;
}
},{"./default":1,"./parser":3,"./xss":5}],3:[function(require,module,exports){
/**
* Simple HTML Parser