toJS property
A JSPromise that either resolves once this Future completes or rejects with its error if it is a JS value and otherwise rejects with a JSWrappedPromiseError that wraps its Dart error value.
Implementation
JSPromise get toJS {
return JSPromise(
(JSFunction resolve, JSFunction reject) {
this.then(
(_) => resolve.callAsFunction(resolve),
onError: (Object error, StackTrace stackTrace) {
final jsError = _convertError(error, stackTrace);
reject.callAsFunction(reject, jsError);
return jsError;
},
);
}.toJS,
);
}