Skip to content

Commit 11d38dd

Browse files
Phase 3: Make JSClosure inherit from JSObject for consistency
Co-authored-by: kateinoigakukun <[email protected]>
1 parent 5e305c8 commit 11d38dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol {
103103
/// button.removeEventListener!("click", JSValue.function(eventListener))
104104
/// ```
105105
///
106-
public class JSClosure: JSFunction, JSClosureProtocol {
106+
public class JSClosure: JSObject, JSClosureProtocol {
107107

108108
class SharedJSClosure {
109109
// Note: 6.0 compilers built with assertions enabled crash when calling
@@ -165,6 +165,10 @@ public class JSClosure: JSFunction, JSClosureProtocol {
165165
fatalError("JSClosure does not support dictionary literal initialization")
166166
}
167167

168+
override public var jsValue: JSValue {
169+
.function(JSFunction(id: self.id))
170+
}
171+
168172
#if compiler(>=5.5) && (!hasFeature(Embedded) || os(WASI))
169173
/// Creates a new `JSClosure` that calls the given Swift function asynchronously.
170174
///

0 commit comments

Comments
 (0)