lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
15 lines • 636 B
JavaScript
// TODO support HTMLCanvasElement - needs changes to Icon class
/**
* A validator function which checks whether an input value is an image source.
* An image source can be a string, an HTMLImageElement or an HTMLVideoElement.
* Doesn't stop the validator chain.
*
* @category XML
*/
export function validateImageSource(value) {
if (typeof value === 'string' || value instanceof HTMLImageElement || value instanceof HTMLVideoElement) {
return [value, false];
}
throw new Error('Invald image source; not a string, HTMLImageElement or HTMLVideoElement instance');
}
//# sourceMappingURL=validateImageSource.js.map