Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hey ,There is a bug!~ #11

Open
kengric opened this issue Jul 21, 2017 · 0 comments
Open

Hey ,There is a bug!~ #11

kengric opened this issue Jul 21, 2017 · 0 comments

Comments

@kengric
Copy link

kengric commented Jul 21, 2017

Code To:
SlimLoadingBarService.start(()=>{alert("complete!")});
When I run the code ,it start ok but can't get my completed status like the "complete!";
I check your slim-loading-bar.service.js code on [email protected].
it does not has the function to onComplete ,
then i fix it simple and the code is down:

SlimLoadingBarService.prototype.start = function (onCompleted) {
var _this = this;
if (onCompleted === void 0) {
onCompleted = null;
}else
this.onCompleted=onCompleted;

// Stop current timer
this.stop();
// Make it visible for sure
this.visible = true;
// Run the timer with milliseconds iterval
this._intervalCounterId = setInterval(function () {
// Increment the progress and update view component
_this.progress++;
// If the progress is 100% - call complete
if (_this.progress === 100) {
_this.complete();
}
}, this.interval);
};
SlimLoadingBarService.prototype.complete = function () {
var _this = this;
this.progress = 100;
this.stop();
setTimeout(function () {
// Hide it away
_this.visible = false;
setTimeout(function () {
// Drop to 0
_this.progress = 0;
}, 250);
}, 250);
this.onCompleted();
};
SlimLoadingBarService.prototype.onCompleted = function () {
};

thanks for your giving!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant