stop-promise
v0.0.5
Published
## installation
Downloads
2
Readme
cancellable-promise
installation
$ npm i stop-promise -D
import
import cancellablePromise from "stop-promise";
make your promise cancellable
Import stop-promise
module.
import cancellablePromise from "stop-promise";
Import your service or other class with promise(s).
import MyService from "services/your-service";
Make your promise cancellable.
const { promise, cancel } = cancellablePromise(MyService.findItems());
Play with your promise as usually:
promise
.then((response) => console.log("Success!", response))
.catch((error) => console.error("Failed...", error));
Cancel your promise when you want by calling cancel
callback.
cancel();