Skip to content

Commit 034bf99

Browse files
authored
Merge pull request #28 from farfromrefug/patch-1
fix: ImageBitmap polyfill
2 parents 90865d3 + 93a208c commit 034bf99

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/canvas-polyfill/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,17 @@ if (!((global as any).TextDecoder instanceof TextDecoder)) {
7575
});
7676
}
7777

78-
if (!((global as any).TextEncoder instanceof TextEncoder)) {
79-
Object.defineProperty(global, 'TextEncoder', {
80-
value: TextEncoder,
78+
if (!((global as any).TextDecoder instanceof TextDecoder)) {
79+
Object.defineProperty(global, 'TextDecoder', {
80+
value: TextDecoder,
81+
configurable: true,
82+
writable: true,
83+
});
84+
}
85+
86+
if (!((global as any).ImageBitmap instanceof ImageBitmap)) {
87+
Object.defineProperty(global, 'ImageBitmap', {
88+
value: ImageBitmap,
8189
configurable: true,
8290
writable: true,
8391
});

0 commit comments

Comments
 (0)