UnsafePromise
-
class
wv.Util.UnsafePromise() This represents a
Promisethat has its promised return value immediately available. The immediate value is unsafe to use (safety depends on specific use cases) until thisUnsafePromisebecomes marked as ready.The primary use case of this would be to synchronously return a reference to an object that needs to wait for an
init(): Promise<void>function to complete.
Properties
-
wv.Util.UnsafePromise.[toStringTag] readonly inherited
[toStringTag]: string
-
wv.Util.UnsafePromise.isReady - isReady: boolean
This value becomes
trueoncethis.readyPromiseresolves. Ifthis.readyPromiserejects, this value never becomestrue.
-
wv.Util.UnsafePromise.readyPromise - readyPromise: Promise
This promise resolves once
this.unsafeValueis safe to access.
-
wv.Util.UnsafePromise.unsafeValue - unsafeValue: T
An unsafe synchronous reference to the value returned through this promise’s
then()callback.
Methods
-
wv.Util.UnsafePromise.catch() inherited
catch(onrejected: (None | (reason: any) => (TResult | PromiseLike))): PromiseAttaches a callback for only the rejection of the Promise.
Parameters
onrejected: (None | (reason: any) => (TResult | PromiseLike))
The callback to execute when the Promise is rejected.Returns: Promise
A Promise for the completion of the callback.
-
wv.Util.UnsafePromise.finally() inherited
finally(onfinally: (None | () => void)): PromiseAttaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Parameters
onfinally: (None | () => void)
The callback to execute when the Promise is settled (fulfilled or rejected).Returns: Promise
A Promise for the completion of the callback.
-
wv.Util.UnsafePromise.then() inherited
then(onfulfilled: (None | (value: T) => (TResult1 | PromiseLike)), onrejected: (None | (reason: any) => (TResult2 | PromiseLike))): PromiseAttaches callbacks for the resolution and/or rejection of the Promise.
Parameters
onfulfilled: (None | (value: T) => (TResult1 | PromiseLike))
The callback to execute when the Promise is resolved.onrejected: (None | (reason: any) => (TResult2 | PromiseLike))
The callback to execute when the Promise is rejected.Returns: Promise
A Promise for the completion of which ever callback is executed.