UNPKG

795 BJavaScriptView Raw
1"use strict";
2var BaseImageResource = require("./BaseImageResource.js");
3class CanvasResource extends BaseImageResource.BaseImageResource {
4 /**
5 * @param source - Canvas element to use
6 */
7 // eslint-disable-next-line @typescript-eslint/no-useless-constructor
8 constructor(source) {
9 super(source);
10 }
11 /**
12 * Used to auto-detect the type of resource.
13 * @param {*} source - The source object
14 * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas
15 */
16 static test(source) {
17 const { OffscreenCanvas } = globalThis;
18 return OffscreenCanvas && source instanceof OffscreenCanvas ? !0 : globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;
19 }
20}
21exports.CanvasResource = CanvasResource;
22//# sourceMappingURL=CanvasResource.js.map