-
Notifications
You must be signed in to change notification settings - Fork 123
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
Is there an easy way to make the canvasRGBA method cancellable? #37
Comments
Sorry, what do you mean by cancelable? It's not an event, so not clear what you mean. The method will silently exit early if the last (6th) argument is not a number (or a string that resolves to a number) or if it is less than 1--in case that's what you meant. Or did you mean that you wanted a method that also fed |
Thanks for the reply!
I guess what I mean is can I cancel the execution of the function mid way through? Set a flag on one of the loops and abort the function early if a flag is set to true? The scenario is we render a heat map and there are controls to move back and forward in time, which triggers the render function. So if a user clicks quickly the render functions get queued up and lock up the UI.
So the behaviour would be similar to resolving a deferred promise to cancel an Ajax network request.
My understanding is I could wrap it in a promise or observable, but I still can’t cancel the function so it would still get processed asynchronously.
Hope that makes sense.
Regards,
Rod
…On 5 Jul 2020, 5:26 PM +1000, Brett Zamir ***@***.***>, wrote:
Sorry, what do you mean by cancelable? It's not an event, so not clear what you mean.
The method will silently exit early if the last (6th) argument is not a number (or a string that resolves to a number) or if it is less than 1--in case that's what you meant.
Or did you mean that you wanted a method that also fed getImageDataFromCanvas to processImageDataRGBA, but returned the resulting imageData instead of passing it to putImageData?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Yes, the function is not implemented asynchronously, so there'd be no way to get alerted even if there were a flag that was checked (a callback could be added within the loops and passed some data, but it would run synchronously, and I wouldn't think that would be of any use). The most granular option would be to make a separate asynchronous version of |
Alternatively, perhaps #16 might help enough to avoid your issue in the first place. |
No description provided.
The text was updated successfully, but these errors were encountered: