We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
JSObject.global
1 parent 20f97ed commit d15c495Copy full SHA for d15c495
Sources/JavaScriptKit/FundamentalObjects/JSObject.swift
@@ -137,7 +137,15 @@ public class JSObject: Equatable {
137
138
/// A `JSObject` of the global scope object.
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)
+ 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
+ nonisolated(unsafe)
145
+ static let _global = JSObject(id: _JS_Predef_Value_Global)
146
+ #else
147
148
+ #endif
149
150
deinit { swjs_release(id) }
151
0 commit comments