Skip to content

Fix equals checks #53

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions nprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,37 +166,37 @@
/**
* Waits for all supplied jQuery promises and
* increases the progress as the promises resolve.
*
*
* @param $promise jQUery Promise
*/
(function() {
var initial = 0, current = 0;

NProgress.promise = function($promise) {
if (!$promise || $promise.state() == "resolved") {
if (!$promise || $promise.state() === "resolved") {
return this;
}
if (current == 0) {

if (current === 0) {
NProgress.start();
}

initial++;
current++;

$promise.always(function() {
current--;
if (current == 0) {
if (current === 0) {
initial = 0;
NProgress.done();
} else {
NProgress.set((initial - current) / initial);
}
});

return this;
};

})();

/**
Expand Down