Created
August 28, 2019 09:24
-
-
Save n1ru4l/9c7eff52fe084d67ff15ae6b0af5f171 to your computer and use it in GitHub Desktop.
offscreen-canvas-polyfill.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!window.OffscreenCanvas) { | |
window.OffscreenCanvas = class OffscreenCanvas { | |
constructor(width, height) { | |
this.canvas = document.createElement("canvas"); | |
this.canvas.width = width; | |
this.canvas.height = height; | |
this.canvas.convertToBlob = () => { | |
return new Promise(resolve => { | |
this.canvas.toBlob(resolve); | |
}); | |
}; | |
return this.canvas; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment