Created
January 18, 2017 21:06
-
-
Save tdouce/69ac55c1eb724fdc0d13e0982c6d27af to your computer and use it in GitHub Desktop.
Execute js every x seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn the-loop | |
[pred-fn todo-fn count] | |
(.setTimeout | |
js/window | |
(fn [] | |
(todo-fn count) | |
(let [count (* 2 count)] | |
(when-not (pred-fn count) | |
(the-loop pred-fn todo-fn count)))) | |
3000)) | |
;;(the-loop (fn [count] (> 0 )) (fn [count] (js/console.log "count: " count)) 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment