-
The events system has been removed. That means that
promiseTracker.on()
andpromiseTracker.off()
no longer exist. In essence, events were a poor way of doing 'hooks' on promises that we wanted to do. See this issue for more information.Open an issue of your own if you were using events and need help migrating to use another method.
Check the README for details on the current API for promiseTracker. (d3770aac)
-
A promiseTracker instance can no longer be created with the
promiseTracker
function, it is a getter only now. UsepromiseTracker.register()
.To migrate your code, change the following:
var newTracker = promiseTracker('newTracker', options); //..later var tracker = promiseTracker('newTracker');
To:
var newTracker = promiseTracker.register('newTracker', options); //..later var tracker = promiseTracker('newTracker');
Check the project README for more details about this change. (cab3c620)
- promiseTracker: add
activationDelay
option (see documentation in README.md)
- support angular-1.2 ngResource)
- Note: Use of angular-1.0.x and angular-1.1.x are now deprecated. They will be removed in the next version.
- fix closure problem (437b4623)
- fix error in ie8 (92d72f2c)
- allow array of tracker names in http tracker option (66d41cdd)
- Fix error with minified files (f8ee34e8)
- Introduce grunt-conventional-changelog (f8b7d23)
Change name of module to ajoslin.promise-tracker
- Follows AngularJS component spec.
- To migrate, just change the name of the module included. For example:
angular.module('myApp', ['ajoslin.promise-tracker']);
Add support for angular-resource
var Books = new $resource('/books');
var bookList = Books.get();
myTracker.addPromise(bookList);
- See more examples in the promiseTracker angular-resource tests.
Add cancel
method for a tracker
- When called,
myTracker.cancel()
will immediately turn the tracker inactive and fire all events.
Add a concept of options for trackers
-
Options can be set when the tracker is first created:
var myTracker = promiseTracker('super_track', { stressLevel: 0 });
-
All options also have setters:
myTracker.setStressLevel(0);
Add minDuration
option
- Passed in with
minDuration
key in options, or set withsetMinDuration
method on a tracker. - Makes it so when a tracker is activated, it will always stay up for at least the given milliseconds.
- For example, if I set minDuration to 1000 and give my tracker three promises that all resolve after 850ms, the tracker will stay active until 1000ms have expired.
Add maxDuration
option
- Passed in with
maxDuration
key in options, or set withsetMaxDuration
method on a tracker. - Makes it so a tracker will automatically deactivate itself after the given milliseconds of being active.
- For example, if I set maxDuration to 5000, no matter how long the promises I give my tracker wait to be resolved, the tracker will deactivate after 5000ms have expired.