Comments (3)
i guess then your suggestion is, that a call of start() should implicitly call stop()? Or should it throw an error if a timer is already started?
from ngprogress.
CHANGE1: In the start method I make a check of intervalCounterId variable:
start: function () {
// TODO Use requestAnimationFrame instead of setInterval
// https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame
this.show();
var self = this;
// RBM call setInterval only if it ha never been called
if (intervalCounterId == undefined) {
intervalCounterId = setInterval(function () {
if (isNaN(count)) {
clearInterval(intervalCounterId);
count = 0;
self.hide();
} else {
CHANGE2: in the reset function i reset the value of intervalCounterId to undefined
reset: function () {
//logger.debug("ngProgress.reset() count=" + count);
clearInterval(intervalCounterId);
intervalCounterId = undefined;
count = 0;
this.updateCount(count);
return 0;
},
CHANGE3: in the nested timeout I simply call the reset method
complete: function () {
//logger.debug("ngProgress.complete() count=" + count);
count = 100;
this.updateCount(count);
var self = this;
$timeout(function () {
self.hide();
$timeout(function () {
//count = 0;
//self.updateCount(count);
self.reset(count);
}, 500);
}, 1000);
return count;
}
Bye
from ngprogress.
+1 I would really like if this would be resolved.
from ngprogress.
Related Issues (20)
- website HOT 4
- Update link reference HOT 1
- Fix naming in bower.json HOT 1
- Broken API? HOT 1
- Typescript definition file HOT 1
- Versions missing from npm HOT 9
- 'main' referenced in package.json doesn't exist. HOT 4
- setParent() not work HOT 4
- Bower Install Warning HOT 2
- ngProgress injected is not the service but the factory HOT 6
- ngProgressFactory function misses it's dependencies HOT 3
- ngProgressFactory injection failed HOT 1
- Documentation issue HOT 1
- progressbar.complete() shouldn't animate unless it has been started
- first param in $timeout&progress speed HOT 1
- TypeError: 'undefined' is not an object (evaluating 'this.parent.appendChild')
- after deploy code in enviroment - ngprogress version not found HOT 1
- NPM Version Request HOT 4
- IE not reflecting DOM updates and progress bar is delayed until the page is nearly done loading HOT 1
- Request for new maintainer HOT 4
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 ngprogress.