@@ -16,7 +16,7 @@ executed.
16
16
If the actual `Promise` object in JavaScript environment lives longer than this `JSPromise`, it may
17
17
attempt to call a deallocated `JSClosure`.
18
18
*/
19
- public final class JSPromise < Success, Failure> : JSValueConvertible , JSValueConstructible {
19
+ public final class JSPromise < Success, Failure> : ConvertibleToJSValue , ConstructibleFromJSValue {
20
20
/// The underlying JavaScript `Promise` object.
21
21
public let jsObject : JSObject
22
22
@@ -88,7 +88,7 @@ extension JSPromise where Success == (), Failure == Never {
88
88
}
89
89
}
90
90
91
- extension JSPromise where Failure: JSValueConvertible {
91
+ extension JSPromise where Failure: ConvertibleToJSValue {
92
92
/** Creates a new `JSPromise` instance from a given `resolver` closure. `resolver` takes
93
93
two closure that your code should call to either resolve or reject this `JSPromise` instance.
94
94
*/
@@ -113,7 +113,7 @@ extension JSPromise where Failure: JSValueConvertible {
113
113
}
114
114
}
115
115
116
- extension JSPromise where Success: JSValueConvertible , Failure: JSError {
116
+ extension JSPromise where Success: ConvertibleToJSValue , Failure: JSError {
117
117
/** Creates a new `JSPromise` instance from a given `resolver` closure. `resolver` takes
118
118
a closure that your code should call to either resolve or reject this `JSPromise` instance.
119
119
*/
@@ -138,7 +138,7 @@ extension JSPromise where Success: JSValueConvertible, Failure: JSError {
138
138
}
139
139
}
140
140
141
- extension JSPromise where Success: JSValueConstructible {
141
+ extension JSPromise where Success: ConstructibleFromJSValue {
142
142
/** Schedules the `success` closure to be invoked on sucessful completion of `self`.
143
143
*/
144
144
public func then(
@@ -160,7 +160,7 @@ extension JSPromise where Success: JSValueConstructible {
160
160
closure invoked on sucessful completion of `self`. The returned promise will have a new
161
161
`Success` type equal to the return type of `success`.
162
162
*/
163
- public func then< ResultType: JSValueConvertible > (
163
+ public func then< ResultType: ConvertibleToJSValue > (
164
164
success: @escaping ( Success ) -> ResultType ,
165
165
file: StaticString = #file,
166
166
line: Int = #line
@@ -179,7 +179,7 @@ extension JSPromise where Success: JSValueConstructible {
179
179
closure invoked on sucessful completion of `self`. The returned promise will have a new type
180
180
equal to the return type of `success`.
181
181
*/
182
- public func then< ResultSuccess: JSValueConvertible , ResultFailure: JSValueConstructible > (
182
+ public func then< ResultSuccess: ConvertibleToJSValue , ResultFailure: ConstructibleFromJSValue > (
183
183
success: @escaping ( Success ) -> JSPromise < ResultSuccess , ResultFailure > ,
184
184
file: StaticString = #file,
185
185
line: Int = #line
@@ -195,12 +195,12 @@ extension JSPromise where Success: JSValueConstructible {
195
195
}
196
196
}
197
197
198
- extension JSPromise where Failure: JSValueConstructible {
198
+ extension JSPromise where Failure: ConstructibleFromJSValue {
199
199
/** Returns a new promise created from chaining the current `self` promise with the `failure`
200
200
closure invoked on rejected completion of `self`. The returned promise will have a new `Success`
201
201
type equal to the return type of the callback, while the `Failure` type becomes `Never`.
202
202
*/
203
- public func `catch`< ResultSuccess: JSValueConvertible > (
203
+ public func `catch`< ResultSuccess: ConvertibleToJSValue > (
204
204
failure: @escaping ( Failure ) -> ResultSuccess ,
205
205
file: StaticString = #file,
206
206
line: Int = #line
@@ -236,7 +236,7 @@ extension JSPromise where Failure: JSValueConstructible {
236
236
closure invoked on rejected completion of `self`. The returned promise will have a new type
237
237
equal to the return type of `success`.
238
238
*/
239
- public func `catch`< ResultSuccess: JSValueConvertible , ResultFailure: JSValueConstructible > (
239
+ public func `catch`< ResultSuccess: ConvertibleToJSValue , ResultFailure: ConstructibleFromJSValue > (
240
240
failure: @escaping ( Failure ) -> JSPromise < ResultSuccess , ResultFailure > ,
241
241
file: StaticString = #file,
242
242
line: Int = #line
0 commit comments