angular-cancelable-q

Provides a cancel method on promises created by the angular $q service.
0 people use it
Author: Assets.github.com%2fimages%2fgravatars%2fgravatar-user-420 trilobyte

Angular Cancelable $q Build Status

Provides a cancel method on promises created by the Angular $q service. It essentially adds a cancel method on the promise interface when asked to wrap a promise. You can use this library to cancel remote requests (well, no truely since the requests themselves are not canceled).

Please note that this library is only useful as long as angular/angular.js#2452 has not made it into the version of Angular you are using.

Usage

API

The cancelable-q provides a single service called cancelableQ. The service has the following public api.

wrap(promise)

Wraps the given promise into a cancelable promise.

promise.cancel(reason)

Wrapped promises will have a cancel(reason) method added to them which cancels given promise with an optional reason. The promise will be rejected using the specified reason.

If no reason is specified canceled will be given as rejection reason.

Copyright

Copyright © 2013 Bert Willems and contributors

License

This project is licensed under MIT. Refer to license.txt for more information.

comments powered by Disqus
This page was last updated over 4 years ago.