You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
586 B
19 lines
586 B
4 months ago
|
import { invariant } from "../../utilities/globals/index.js";
|
||
|
export function toPromise(observable) {
|
||
|
var completed = false;
|
||
|
return new Promise(function (resolve, reject) {
|
||
|
observable.subscribe({
|
||
|
next: function (data) {
|
||
|
if (completed) {
|
||
|
globalThis.__DEV__ !== false && invariant.warn(42);
|
||
|
}
|
||
|
else {
|
||
|
completed = true;
|
||
|
resolve(data);
|
||
|
}
|
||
|
},
|
||
|
error: reject,
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
//# sourceMappingURL=toPromise.js.map
|