We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 86dcd39 commit e6dc9edCopy full SHA for e6dc9ed
Sources/JavaScriptKit/JSValueConvertible.swift
@@ -1,18 +1,22 @@
1
import _CJavaScriptKit
2
3
-public protocol JSBridgedType: JSValueCodable, CustomStringConvertible {
4
- static var classRef: JSFunctionRef { get }
5
-
+// Use this protocol when your type has no single JavaScript class.
+// For example, a union type of multiple classes.
+public protocol JSAbstractBridgedType: JSValueCodable, CustomStringConvertible {
6
var objectRef: JSObjectRef { get }
7
init(objectRef: JSObjectRef)
8
}
9
10
-extension JSBridgedType {
+extension JSAbstractBridgedType {
11
public var description: String {
12
return objectRef.toString!().fromJSValue()
13
14
15
16
+public protocol JSBridgedType: JSAbstractBridgedType {
17
+ static var classRef: JSFunctionRef { get }
18
+}
19
+
20
public protocol JSValueEncodable {
21
func jsValue() -> JSValue
22
0 commit comments