createElAsync<K>
Creates an element asynchronously.
Not refactored to parameter-object pattern, to keep the parity with
obsidian#createEl(or createSvg, correspondingly).
Import:
import { createElAsync } from 'obsidian-dev-utils/html-element';Signature:
function createElAsync(tag: K, o: string | DomElementInfo | undefined, callback: ((el: HTMLElementTagNameMap[K]) => Promisable<void>) | undefined): Promise<HTMLElementTagNameMap[K]>Parameters:
| Parameter | Type | Description |
|---|---|---|
tag | K | The tag name of the element to create. |
o | string | DomElementInfo | undefined | The element information. |
callback | ((el: HTMLElementTagNameMap[K]) => Promisable<void>) | undefined | The callback to call when the element is created. |
Returns: Promise<HTMLElementTagNameMap[K]> — A Promise that resolves to the element.