File tree 1 file changed +10
-1
lines changed
Sources/JavaScriptKit/FundamentalObjects
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,16 @@ public class JSObject: Equatable {
137
137
138
138
/// A `JSObject` of the global scope object.
139
139
/// This allows access to the global properties and global names by accessing the `JSObject` returned.
140
- public static let global = JSObject ( id: _JS_Predef_Value_Global)
140
+ public static var global : JSObject { return _global }
141
+
142
+ // `JSObject` storage itself is immutable, and use of `JSObject.global` from other
143
+ // threads maintains the same semantics as `globalThis` in JavaScript.
144
+ #if compiler(>=5.10)
145
+ nonisolated ( unsafe)
146
+ static let _global = JSObject ( id: _JS_Predef_Value_Global)
147
+ #else
148
+ static let _global = JSObject ( id: _JS_Predef_Value_Global)
149
+ #endif
141
150
142
151
deinit { swjs_release ( id) }
143
152
You can’t perform that action at this time.
0 commit comments