Skip to main content

getOrCreateCanvas

Callable

  • getOrCreateCanvas(element: HTMLDivElement): HTMLCanvasElement

  • Create a canvas or returns the one that already exists for a given element. It first checks if the element has a canvas, if not it creates one and returns it.


    Parameters

    • element: HTMLDivElement

      An HTML Element

    Returns HTMLCanvasElement

    canvas a Canvas DOM element