Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update setSource in nextTick #1710

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants