Skip to content

Commit 609cff1

Browse files
Final: Add documentation and migration guidance for unification
Co-authored-by: kateinoigakukun <[email protected]>
1 parent f9b76bf commit 609cff1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol {
103103
/// button.removeEventListener!("click", JSValue.function(eventListener))
104104
/// ```
105105
///
106+
/// - Note: JSClosure now inherits from JSObject directly instead of JSFunction,
107+
/// providing a consistent and unified object model that aligns with JavaScript's
108+
/// dynamic callability semantics.
106109
public class JSClosure: JSObject, JSClosureProtocol {
107110

108111
class SharedJSClosure {

Sources/JavaScriptKit/FundamentalObjects/JSFunction.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import _CJavaScriptKit
1010
/// alert("Hello, world")
1111
/// ```
1212
///
13+
/// - Note: In a future version, JSFunction will be unified with JSObject.
14+
/// Consider using JSObject directly for new code, as all objects in JavaScript
15+
/// can potentially be callable. JSFunction functionality is now available on JSObject.
1316
public class JSFunction: JSObject {
1417
#if !hasFeature(Embedded)
1518
/// Call this function with given `arguments` and binding given `this` as context.

0 commit comments

Comments
 (0)