We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f75f42 commit b353aacCopy full SHA for b353aac
src/utils/image.js
@@ -121,8 +121,12 @@ export class RawImage {
121
return await this.fromURL(input);
122
} else if (input instanceof Blob) {
123
return await this.fromBlob(input);
124
- } else if (input instanceof HTMLCanvasElement || input instanceof OffscreenCanvas) {
125
- return await this.fromCanvas(input);
+ } else if (
+ (typeof HTMLCanvasElement !== "undefined" && input instanceof HTMLCanvasElement)
126
+ ||
127
+ (typeof OffscreenCanvas !== "undefined" && input instanceof OffscreenCanvas)
128
+ ) {
129
+ return this.fromCanvas(input);
130
} else {
131
throw new Error(`Unsupported input type: ${typeof input}`);
132
}
0 commit comments