@xylabs/threads 3.0.4 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,13 @@
4
4
  /// <reference lib="dom" />
5
5
  // tslint:disable no-shadowed-variable
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- if (self === undefined) {
7
+ try {
8
+ if (self === undefined) {
9
+ ;
10
+ global.self = global;
11
+ }
12
+ }
13
+ catch {
8
14
  ;
9
15
  global.self = global;
10
16
  }
@@ -2,7 +2,13 @@
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
3
  /// <reference lib="dom" />
4
4
  // tslint:disable no-shadowed-variable
5
- if (self === undefined) {
5
+ try {
6
+ if (self === undefined) {
7
+ ;
8
+ global.self = global;
9
+ }
10
+ }
11
+ catch {
6
12
  ;
7
13
  global.self = global;
8
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/threads",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Web workers & worker threads as simple as a function call",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -12,8 +12,11 @@ interface WorkerGlobalScope {
12
12
  }
13
13
 
14
14
  declare const self: WorkerGlobalScope
15
-
16
- if (self === undefined) {
15
+ try {
16
+ if (self === undefined) {
17
+ ;(global as any).self = global
18
+ }
19
+ } catch {
17
20
  ;(global as any).self = global
18
21
  }
19
22