File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
import _CJavaScriptKit
2
2
3
- public protocol JSBridgedType : JSValueCodable , CustomStringConvertible {
4
- static var classRef : JSFunctionRef { get }
5
-
3
+ // Use this protocol when your type has no single JavaScript class.
4
+ // For example, a union type of multiple classes.
5
+ public protocol JSAbstractBridgedType : JSValueCodable , CustomStringConvertible {
6
6
var objectRef : JSObjectRef { get }
7
7
init ( objectRef: JSObjectRef )
8
8
}
9
9
10
- extension JSBridgedType {
10
+ extension JSAbstractBridgedType {
11
11
public var description : String {
12
12
return objectRef. toString!( ) . fromJSValue ( )
13
13
}
14
14
}
15
15
16
+ public protocol JSBridgedType : JSAbstractBridgedType {
17
+ static var classRef : JSFunctionRef { get }
18
+ }
19
+
16
20
public protocol JSValueEncodable {
17
21
func jsValue( ) -> JSValue
18
22
}
You can’t perform that action at this time.
0 commit comments