Skip to content

Conversation

Gcaufy
Copy link

@Gcaufy Gcaufy commented Nov 24, 2020

When set img.src=some_buffer the onload callback function may not be called.

Demo code:

const img = new Image(); img.src = some_image_buffer; img.onload = () => { alert('success'); }

In this case, onload will never be called.
After I check the code below:
https://github.com/Automattic/node-canvas/blob/master/src/Image.cc#L278-L281

I change the code to:

const img = new Image(); img.onload = () => { alert('success'); } img.src = some_image_buffer; 

And this code works well.

  • Have you updated CHANGELOG.md?
    No, I will update it after the pr was approved.
@jimmywarting
Copy link
Contributor

if createImageBitmap(blob) is being introduced, then new Image() will be discouraged, depricated or removed

@zbjornson zbjornson force-pushed the master branch 2 times, most recently from 64ed3d8 to ff0f2ab Compare December 28, 2023 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants