Browse files

Add every() and after()

  • Loading branch information...
1 parent e74da56 commit 11a0f5545bd472c53ad0597f708ee9057b7ef5ad @marcuswestin committed Jun 4, 2013
Showing with 12 additions and 0 deletions.
  1. +4 −0 after.js
  2. +8 −0 every.js
View
4 after.js
@@ -0,0 +1,4 @@
+module.exports = function after(durationInMs, fn) {
+ return setTimeout(fn, durationInMs)
+}
+
View
8 every.js
@@ -0,0 +1,8 @@
+var nextTick = require('./nextTick')
+
+module.exports = function every(intervalMs, fn) {
+ nextTick(function executeAndSchedule() {
+ setTimeout(executeAndSchedule, intervalMs)
+ fn()
+ })
+}

0 comments on commit 11a0f55

Please sign in to comment.