Skip to content

Instantly share code, notes, and snippets.

@tdouce
Created January 18, 2017 21:06
Show Gist options
  • Save tdouce/69ac55c1eb724fdc0d13e0982c6d27af to your computer and use it in GitHub Desktop.
Save tdouce/69ac55c1eb724fdc0d13e0982c6d27af to your computer and use it in GitHub Desktop.
Execute js every x seconds
(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