awaitNotifiedElement()function

awaitNotifiedElement(el: EventTarget | undefined, pending: PromiseLike<ReactNode | undefined | void>): Promise<boolean>
ParamType
elEventTarget
Element to dispatch the notice event on (defaults to window when undefined).
pendingPromiseLike<ReactNode
void>
The promise-like value to await.
Return
Promise<boolean>
true if the value resolved, false if it rejected.

Await a pending value and dispatch a success or error notice to a specific element based on its resolution.

  • A resolved truthy value becomes a "success" notice; a rejection becomes an "error" notice via notifyThrown().

Examples

await awaitNotifiedElement(formEl, save());