Skip to content

Commit

Permalink
Build fix for Swift 5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed Nov 28, 2024
1 parent 9b7fda0 commit c68679a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/JavaScriptKit/FundamentalObjects/JSObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ public class JSObject: Equatable {
/// This allows access to the global properties and global names by accessing the `JSObject` returned.
public static var global: JSObject { return _global }

// `JSObject` storage itself is immutable, and use of `JSObject.global` from other
// threads maintains the same semantics as `globalThis` in JavaScript.
#if compiler(>=5.10)
@LazyThreadLocal(initialize: {
return JSObject(id: _JS_Predef_Value_Global)
})
private static var _global: JSObject
#else
private static let _global = JSObject(id: _JS_Predef_Value_Global)
#endif

deinit {
assertOnOwnerThread(hint: "deinitializing")
Expand Down

0 comments on commit c68679a

Please sign in to comment.