Home > @gglib/utils > getOrCreateCanvas

getOrCreateCanvas() function

Gets a canvas element by a CSS selector or creates a new instance of HTMLCanvasElement

Signature:

export declare function getOrCreateCanvas(canvas?: string | HTMLCanvasElement): HTMLCanvasElement;

Parameters

Parameter Type Description
canvas string | HTMLCanvasElement

Returns:

HTMLCanvasElement