Comments (7)
I think this is a feature which is definitely needed. It's also not hard to implement, but currently, listeners are just get pushed to a callbacks array and then get fired at a certain point. Now.. when taking a look at this construct... wouldn't it be cooler to use $rootScope.$broadcast()
for the whole event handling? @ajoslin, what do you say?
from angular-promise-tracker.
We could use $rootScope.$broadcast.. But it seems bad to make the whole scope hierarchy be traversed for events every time any promise tracked does anything (which could potentially be many times per minute). Also the syntax is bad (look below).
...and for the callbacks, how about this (if we went with the current syntax):
myTracker.on('start', function(startArgument, promiseId) {
}).on('done', function(doneArg, promiseId) {
});
If we went with scope events, it would be:
$scope.$on('promiseTracker.start', function($event, promiseTracker, promiseId, startArg) {
});
That's too ugly IMO.
I'll be using AngularJS's nextUid function so I will never run out of ids.
from angular-promise-tracker.
Yep, perfect! That's exactly what I had in mind!
Didn't even know about their nextUid function, so thanks for that as well!
from angular-promise-tracker.
Done in 94a62dc :-)
Check the commit notes for an example.
from angular-promise-tracker.
@ajoslin Great job! Just for the records: You aren't able to use angular's nextUid function (without defining it in your provider)?
from angular-promise-tracker.
Angular's isn't exposed unfortunately - it's private.
from angular-promise-tracker.
Hmpf. Okay.
from angular-promise-tracker.
Related Issues (20)
- Pass tracker options along $http interceptor, or at promiseTracker "get" constructor HOT 3
- Add a usage example HOT 2
- test
- test
- test
- Allow manually pushing to the http interceptor list HOT 4
- 2.0.1 is not properly released (no tag etc.) HOT 3
- Re-add uglify to build process HOT 2
- publish to npm HOT 4
- Error when using with angularjs 1.3.0-rc.3 HOT 10
- View active promises HOT 3
- Active after requests have been satisfied HOT 4
- Please tag release v2.1.0 HOT 1
- infinite loop
- Publish 2.1.0 to npm HOT 8
- Add commonJS support
- Add minified files to the release package.
- Enhancement: return the added promise from `addPromise` HOT 2
- trackingCount() and active() not updating? HOT 1
- Improper tracked[] element removal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-promise-tracker.