tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
36 lines • 1.43 kB
text/typescript
export default TinyHtmlCanvas;
/**
* TinyHtmlCanvas is a helper for <canvas> elements,
* providing a direct way to configure its size and retrieve the rendering context.
*
* @example
* const canvas = new TinyHtmlCanvas({ width: 800, height: 600 });
* const ctx = canvas.getContext('2d');
*
* @extends TinyHtmlTemplate<HTMLCanvasElement>
*/
declare class TinyHtmlCanvas extends TinyHtmlTemplate<HTMLCanvasElement> {
/**
* Creates a new TinyHtmlCanvas instance.
* @param {Object} config
* @param {number} [config.width] - Canvas width in pixels.
* @param {number} [config.height] - Canvas height in pixels.
* @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes.
* @param {string} [config.mainClass=""] - Main CSS class.
*/
constructor({ width, height, tags, mainClass }?: {
width?: number | undefined;
height?: number | undefined;
tags?: string | string[] | Set<string> | undefined;
mainClass?: string | undefined;
});
/**
* Gets the rendering context of the canvas.
* @param {string} [type="2d"] - Context type ("2d", "webgl", etc.).
* @param {any} [options={}] - Context options.
* @returns {RenderingContext|null}
*/
getContext(type?: string, options?: any): RenderingContext | null;
}
import TinyHtmlTemplate from './TinyHtmlTemplate.mjs';
//# sourceMappingURL=TinyHtmlCanvas.d.mts.map