Skip to content

Commit 8a6878f

Browse files
committed
More updates
1 parent afe98ae commit 8a6878f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Sources/JavaScriptKit/JSValueConvertible.swift

+8-6
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@ public protocol JSValueConvertible {
2323

2424
public typealias JSValueCodable = JSValueConvertible & JSValueConstructible
2525

26-
extension JSBridgedType {
27-
public static func canDecode(from jsValue: JSValue) -> Bool {
28-
jsValue.isInstanceOf(Self.classRef)
29-
}
30-
26+
extension JSAbstractBridgedType {
3127
public init(jsValue: JSValue) {
3228
self.init(objectRef: jsValue.object!)
3329
}
3430

3531
public func jsValue() -> JSValue {
36-
return JSValue.object(objectRef)
32+
.object(objectRef)
33+
}
34+
}
35+
36+
extension JSBridgedType {
37+
public static func canDecode(from jsValue: JSValue) -> Bool {
38+
jsValue.isInstanceOf(Self.classRef)
3739
}
3840
}
3941

Sources/JavaScriptKit/Support.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public struct AnyJSValueCodable: JSValueCodable, ExpressibleByNilLiteral {
4545
}
4646
}
4747

48-
public func staticCast<Type: JSBridgedType>(_ ref: JSBridgedType) -> Type {
48+
public func staticCast<Type: JSAbstractBridgedType>(_ ref: JSAbstractBridgedType) -> Type {
4949
return Type(objectRef: ref.objectRef)
5050
}
5151

0 commit comments

Comments
 (0)