Skip to content

Commit 9102398

Browse files
fjtrujycburgmer
authored andcommitted
Adding offscreencanvas support
1 parent 262b340 commit 9102398

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/typings.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export interface Error {
174174
*/
175175
export function drawHTML(
176176
html: string,
177-
canvas: HTMLCanvasElement,
177+
canvas: HTMLCanvasElement | OffscreenCanvas,
178178
options?: Options
179179
): Promise<RenderResult>;
180180

@@ -197,7 +197,7 @@ export function drawHTML(
197197
*/
198198
export function drawURL(
199199
url: string,
200-
canvas: HTMLCanvasElement,
200+
canvas: HTMLCanvasElement | OffscreenCanvas,
201201
options?: Options
202202
): Promise<RenderResult>;
203203

@@ -220,6 +220,6 @@ export function drawURL(
220220
*/
221221
export function drawDocument(
222222
document: Document,
223-
canvas: HTMLCanvasElement,
223+
canvas: HTMLCanvasElement | OffscreenCanvas,
224224
options?: Options
225225
): Promise<RenderResult>;

src/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var util = (function (url) {
4040
isObject(obj) &&
4141
Object.prototype.toString
4242
.apply(obj)
43-
.match(/\[object (Canvas|HTMLCanvasElement)\]/i)
43+
.match(/\[object (Canvas|HTMLCanvasElement|OffscreenCanvas)\]/i)
4444
);
4545
};
4646

0 commit comments

Comments
 (0)