File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import * as tf from "@tensorflow/tfjs";
7
7
/**
8
8
* Standard input accepted by most TensorFlow models.
9
9
* @typedef InputImage
10
- * @type {ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | tf.Tensor3D }
10
+ * @type {ImageData | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | HTMLVideoElement | tf.Tensor3D }
11
11
*/
12
12
13
13
/**
@@ -40,13 +40,13 @@ export const isAudio = (img) => {
40
40
} ;
41
41
42
42
/**
43
- * Check if a variable is an HTMLCanvasElement.
43
+ * Check if a variable is an HTMLCanvasElement or OffscreenCanvas
44
44
* @param {any } img
45
45
* @returns {img is HTMLCanvasElement }
46
46
*/
47
47
export const isCanvas = ( img ) => {
48
48
return (
49
- typeof HTMLCanvasElement !== "undefined" && img instanceof HTMLCanvasElement
49
+ typeof HTMLCanvasElement !== "undefined" && ( img instanceof HTMLCanvasElement || img instanceof OffscreenCanvas )
50
50
) ;
51
51
} ;
52
52
You can’t perform that action at this time.
0 commit comments