Skip to content

Instantly share code, notes, and snippets.

@n1ru4l
Created August 28, 2019 09:24
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save n1ru4l/9c7eff52fe084d67ff15ae6b0af5f171 to your computer and use it in GitHub Desktop.
Save n1ru4l/9c7eff52fe084d67ff15ae6b0af5f171 to your computer and use it in GitHub Desktop.
offscreen-canvas-polyfill.js
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