Skip to content

Commit f921827

Browse files
committed
fix ts_helpers to use globalThis
1 parent 30203a4 commit f921827

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

test-app/app/src/main/assets/internal/ts_helpers.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
d;
1313

1414
if (
15-
typeof global.Reflect === "object" &&
16-
typeof global.Reflect.decorate === "function"
15+
typeof globalThis.Reflect === "object" &&
16+
typeof globalThis.Reflect.decorate === "function"
1717
) {
18-
r = global.Reflect.decorate(decorators, target, key, desc);
18+
r = globalThis.Reflect.decorate(decorators, target, key, desc);
1919
} else {
2020
for (var i = decorators.length - 1; i >= 0; i--) {
2121
if ((d = decorators[i])) {
@@ -56,6 +56,7 @@
5656
var __extends = function (Child, Parent) {
5757
var extendNativeClass =
5858
!!Parent.extend && Parent.extend.toString().indexOf("[native code]") > -1;
59+
5960
if (!extendNativeClass) {
6061
__extends_ts(Child, Parent);
6162
return;
@@ -189,18 +190,19 @@
189190
}
190191
};
191192
}
193+
Object.defineProperty(globalThis, "__native", { value: __native });
194+
Object.defineProperty(globalThis, "__extends", { value: __extends });
195+
Object.defineProperty(globalThis, "__decorate", { value: __decorate });
196+
192197

193-
Object.defineProperty(global, "__native", { value: __native });
194-
Object.defineProperty(global, "__extends", { value: __extends });
195-
Object.defineProperty(global, "__decorate", { value: __decorate });
196198

197-
if (!global.__ns__worker) {
198-
global.JavaProxy = JavaProxy;
199+
if (!globalThis.__ns__worker) {
200+
globalThis.JavaProxy = JavaProxy;
199201
}
200-
global.Interfaces = Interfaces;
202+
globalThis.Interfaces = Interfaces;
201203

202-
if (global.WeakRef && !global.WeakRef.prototype.get) {
203-
global.WeakRef.prototype.get = global.WeakRef.prototype.deref;
204+
if (globalThis.WeakRef && !globalThis.WeakRef.prototype.get) {
205+
globalThis.WeakRef.prototype.get = globalThis.WeakRef.prototype.deref;
204206
}
205207

206208
// Native array access: numeric indexing and the map/forEach/toString/

0 commit comments

Comments
 (0)