/** * Simple wrapper for creating and managing a canvas element. * Supports full-screen or container-relative sizing. */ export default class Canvas { /** The underlying HTMLCanvasElement. */ canvas: HTMLCanvasElement; /** Optional callback fired when the canvas resizes. */ onResize?: () => void; private _resizeObserver?; /** * initialises a new instance of Canvas. * @param parentElement Optional HTML element to inject the canvas into. */ constructor(parentElement?: HTMLElement); /** * Resizes the canvas to match its container or window dimensions. * @param parent Optional parent element to match size with. */ resize(parent?: HTMLElement): void; private _onResizeObserved; /** * Completely removes the canvas element and cleans up its observers. */ destroy(): void; }