Skip to content

Instantly share code, notes, and snippets.

View jayantbh's full-sized avatar
🟣
Building middlewarehq.com

Jayant Bhawal jayantbh

🟣
Building middlewarehq.com
View GitHub Profile
@jayantbh
jayantbh / offscreen-canvas-polyfill.js
Last active July 28, 2023 01:32 — forked from n1ru4l/offscreen-canvas-polyfill.js
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.transferToImageBitmap = () => {
const ctx = this.canvas.getContext('2d');
if (!ctx) return;