#promise #js #cancellable

cancellable-promise

Cancellable JS promise in Rust

1 unstable release

0.1.0 Aug 9, 2023

#27 in #promise

MIT license

3KB

Cancellable JS promise in Rust

Usage

let promise = wasm_bindgen_futures::future_to_promise(async move {
    ...
});

let abort_controller = Box::new(worker::AbortController::default());
let output = cancellable_promise::make(abort_controller.signal(), promise);

// eventually ...

abort_controller.abort();

Dependencies

~15–24MB
~344K SLoC