Speaking to @zzorba and @bdk: the concept of cancellation in both Rust and Javascript/Typescript is similar: it is really a request for cancellation, which the task co-operatively decides to respect or not.
For generated code, Rust is going to send a request to Javascript. In Javascript an AbortController maintains a signal. If we make a new AbortController for each async callback method call, and pass the callback signal, this might be a) unobtrusive for the callbacks that doesn't want to offer the task cancellation b) available to those that do.
Proof of concept that typescript methods can accept optional parameters.
Speaking to @zzorba and @bdk: the concept of cancellation in both Rust and Javascript/Typescript is similar: it is really a request for cancellation, which the task co-operatively decides to respect or not.
For generated code, Rust is going to send a request to Javascript. In Javascript an
AbortController
maintains a signal. If we make a new AbortController for each async callback method call, and pass the callback signal, this might be a) unobtrusive for the callbacks that doesn't want to offer the task cancellation b) available to those that do.Proof of concept that typescript methods can accept optional parameters.
Playground Link