Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ab414d7

Browse files
committed
Make dyamicMember return a JSFunctionRef in the disfavoredOverload
1 parent 9b47115 commit ab414d7

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

‎Sources/JavaScriptKit/JSObject.swift‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,14 @@ public class JSObjectRef: Equatable {
88
}
99

1010
@_disfavoredOverload
11-
public subscript(_ name: String) -> ((JSValueEncodable...)->JSValue)? {
11+
public subscript(_ name: String) -> JSFunctionRef? {
1212
guard let function = self[name].function else { return nil }
13-
return { (arguments: JSValueEncodable...) in
14-
function(this: self, args: arguments)
15-
}
13+
return function
1614
}
1715

1816
@_disfavoredOverload
19-
public subscript(dynamicMember name: String) -> ((JSValueEncodable...) -> JSValue)? {
20-
guard let function = self[name].function else { return nil }
21-
return { (arguments: JSValueEncodable...) in
22-
function(this: self, args: arguments)
23-
}
17+
public subscript(dynamicMember name: String) -> JSFunctionRef? {
18+
self[name]
2419
}
2520

2621
public subscript(dynamicMember name: String) -> JSValue {

‎Sources/JavaScriptKit/JSValueConvertible.swift‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,9 @@ extension Dictionary: JSValueDecodable where Value: JSValueDecodable, Key == Str
155155

156156
public init(jsValue: JSValue) {
157157
let objectRef: JSObjectRef = jsValue.object!
158-
159158
let keys: [String] = JSObject.keys!(objectRef.jsValue()).fromJSValue()
160159
self = Dictionary(uniqueKeysWithValues: keys.map {
161-
(0ドル, objectRef[dynamicMember:0ドル].fromJSValue())
160+
(0ドル, objectRef[0ドル].fromJSValue())
162161
})
163162
}
164163
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /