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
feat(): support aborting promises/requests #7827
Conversation
clear canvas right before reload instead of before enlivening, which may take time in case of heavy images/resources
I think we should consider migrating |
if (!json) { | ||
return; | ||
return Promise.reject(new Error('fabric.js: `json` is undefined')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BREAKING
read all the PR, and the only thing i disagree is providing the abort controller ourselves. We would also not need to provide a method to interrup the current task, supporting the existance of an abort signal is all we should surface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only thing i disagree is providing the abort controller ourselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I insist for the Abort controller being passed from outside in the functions where we decided to generate it automatically.
That does not change the functionality you are proposing, and allows for better integration of loading tasks.
The operation can be cancelled from inside or from outside, and most importantly the same abort signal from the used abort controller can be passed to other systems that needs to be cancelled on coordination.
Other than it allow us to leave node 14 support on.
I still don't understand how it solves the bug I described or how I can set |
i don't see |
I can understand this and live with it but I think it's a bad idea because it will surface fake bugs from devs. And it is expected behavior not to have race conditions. But not EDITED I gave a deeper look. Does |
It doesn't which IMO should be viewed as a bug |
indeed src is not an image of the property, setSrc is like, a, change the element. It does not even update it, it totally changes it ( and that is fine because the previous one could be a canvas element ). |
Good point I now understand your point |
probably the bug is the name of the method. Probably that is setElementFromSrc |
Yeah we should rename and add logic |
Code Coverage Summary
|
Code Coverage Summary
|
Code Coverage Summary
|
1 similar comment
Code Coverage Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
READY!
Merging this, i ll follow up restoring node 14 adding a polyfill in the dev-deps |
Motivation #7075
Gist
https://developer.mozilla.org/en-US/docs/Web/API/AbortController
https://dev.to/abdus/terminating-dom-operations-at-will-abortcontroller-in-javascript-1icm
https://nodejs.org/api/globals.html#class-abortcontroller
In Action
https://codesandbox.io/s/mpcq6z