File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
Sources/JavaScriptKit/JS Types Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ public final class JSBluetooth: JSType {
28
28
/// - Returns: A Promise to a `BluetoothDevice` object.
29
29
public func requestDevice( //filters: [] = [],
30
30
//services: [] = [],
31
- /*acceptAllDevices: Bool = true*/) -> JSPromise < JSBluetoothDevice > {
31
+ acceptAllDevices: Bool = true ) -> JSPromise < JSBluetoothDevice > {
32
+
33
+ JSObjectRef . global. console. object? . log. function ? ( " \( #file) \( String ( reflecting: type ( of: self ) ) ) \( #function) \( #line) " )
32
34
33
35
enum Option : String {
34
36
case filters
@@ -44,14 +46,15 @@ public final class JSBluetooth: JSType {
44
46
45
47
// FIXME: Improve, support all options
46
48
let options = JSObject ( )
47
- options [ Option . acceptAllDevices. rawValue] = JSBoolean ( true ) . jsValue ( )
49
+ options [ Option . acceptAllDevices. rawValue] = JSBoolean ( acceptAllDevices ) . jsValue ( )
48
50
options [ Option . optionalServices. rawValue] = [ " device_information " ] . jsValue ( )
49
51
50
52
let result = function ( options. jsValue ( ) )
53
+ JSObjectRef . global. console. object? . log. function ? ( " \( #file) \( String ( reflecting: type ( of: self ) ) ) \( #function) \( #line) " )
51
54
52
55
guard let promise = result. object. flatMap ( { JSPromise < JSBluetoothDevice > ( $0) } )
53
56
else { fatalError ( " Invalid object \( result) " ) }
54
-
57
+ JSObjectRef . global . console . object ? . log . function ? ( " \( #file ) \( String ( reflecting : type ( of : self ) ) ) \( #function ) \( #line ) " )
55
58
return promise
56
59
}
57
60
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ extension JSBoolean: CustomStringConvertible { }
36
36
37
37
extension JSBoolean : ExpressibleByBooleanLiteral {
38
38
39
- public init ( booleanLiteral value: Bool ) {
39
+ public convenience init ( booleanLiteral value: Bool ) {
40
40
self . init ( value)
41
41
}
42
42
}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public class JSError: JSType, Error {
17
17
18
18
// MARK: - Initialization
19
19
20
- public init ( _ jsObject: JSObjectRef ) {
20
+ public required init ? ( _ jsObject: JSObjectRef ) {
21
21
self . jsObject = jsObject
22
22
}
23
23
You can’t perform that action at this time.
0 commit comments