Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

check condition first in until method, and if it's true then execute …

…callback.
  • Loading branch information...
commit 61685f4a25a917dc8e2be9b92a19798407f68f86 1 parent 81e0cf4
@iamyellow iamyellow authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 wait.js
View
7 wait.js
@@ -94,6 +94,11 @@
};
root.until = function(condition, callback, time, id) {
+ if (condition()) {
+ callback();
+ return;
+ }
+
if (arguments.length === 3) {
if (isTime(time) || isNumber(time)) {
time = time;
@@ -114,7 +119,7 @@
root.clear(interval);
callback();
}
- }, id, true);
+ }, id, false);
return interval;
};
Please sign in to comment.
Something went wrong with that request. Please try again.