awaitNotifiedElement()function
awaitNotifiedElement(el: EventTarget | undefined, pending: PromiseLike<ReactNode | undefined | void>): Promise<boolean>
| Param | Type | |
|---|---|---|
el | EventTarget | Element to dispatch the notice event on (defaults to window when undefined). |
pending | PromiseLike<ReactNodevoid> | 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 vianotifyThrown().
Examples
await awaitNotifiedElement(formEl, save());