Skip to content

createSvgAsync<K>

Creates a svg asynchronously.

Not refactored to parameter-object pattern, to keep the parity with Obsidian’s createSvg (or createEl, correspondingly).

Import:

import { createSvgAsync } from '@mnaoumov/typescript-lib/html-element';

Signature:

function createSvgAsync(tag: K, o: string | CreateSvgElementInfo | undefined, callback: ((element: SVGElementTagNameMap[K]) => Promisable<void>) | undefined): Promise<SVGElementTagNameMap[K]>

Parameters:

Parameter Type Description
tag K The tag name of the svg to create.
o string | CreateSvgElementInfo | undefined The svg information.
callback ((element: SVGElementTagNameMap[K]) => Promisable<void>) | undefined The callback to call when the svg is created.

Returns: Promise<SVGElementTagNameMap[K]> — A Promise that resolves to the svg.


Links to this page: