@feature-hub/core
Version:
Create scalable web applications using micro frontends.
16 lines • 525 B
JavaScript
/**
* An `AsyncValue` provides a promise and as soon as the promise resolves or
* rejects, also exposes the returned value or error. It is useful for
* accessing a promise value in a synchronous context.
*/
export class AsyncValue {
constructor(promise, value, error) {
this.promise = promise;
this.value = value;
this.error = error;
promise
.then((val) => (this.value = val))
.catch((err) => (this.error = err));
}
}
//# sourceMappingURL=async-value.js.map