File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Sources/JavaScriptKit/FundamentalObjects Expand file tree Collapse file tree 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 {
137137
138138 /// A `JSObject` of the global scope object.
139139 /// 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
141150
142151 deinit { swjs_release ( id) }
143152
You can’t perform that action at this time.
0 commit comments