Permalink
Browse files

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

…callback.
  • Loading branch information...
1 parent 81e0cf4 commit 61685f4a25a917dc8e2be9b92a19798407f68f86 @iamyellow iamyellow committed Nov 12, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 wait.js
View
@@ -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;
};

0 comments on commit 61685f4

Please sign in to comment.