Permalink
Browse files

add waitFor

  • Loading branch information...
1 parent d370e5a commit 88fc9d2f39be47650bb267242555c82251cf567a @marcuswestin committed Dec 12, 2012
Showing with 16 additions and 0 deletions.
  1. +3 −0 Changelog
  2. +13 −0 waitFor.js
View
@@ -1,3 +1,6 @@
+Intended v0.1.37
++ implemented waitFor
+
v0.1.35
+ Better touch detection
View
@@ -0,0 +1,13 @@
+module.exports = function waitFor(num, callback) {
+ var error
+ return function(err, res) {
+ if (num == 0) { return log.warn("waitFor was called more than the expected number of times") }
+ if (error) { return }
+ if (err) {
+ error = err
+ return callback(err)
+ }
+ num -= 1
+ if (num == 0) { callback(null) }
+ }
+}

0 comments on commit 88fc9d2

Please sign in to comment.