Skip to content

Commit

Permalink
fix: BytePlatform img addEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
deepkolos committed May 10, 2021
1 parent 18997da commit b64a8a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/BytePlatform/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ export class BytePlatform {
this.document = {
createElementNS(_, type) {
if (type === 'canvas') return canvas;
if (type === 'img') return canvas.createImage();
if (type === 'img'){
const img = canvas.createImage();
img.addEventListener = (name, cb) => (img[`on${name}`] = cb.bind(img));
img.removeEventListener = (name, cb) => (img[`on${name}`] = null);
return img;
}
},
};

Expand Down

0 comments on commit b64a8a1

Please sign in to comment.