(game-loop f game)

Source

(defn game-loop [f game] #?(:clj {:f f, :game game} :cljs (let [game (f game)] (js/requestAnimationFrame (fn [ts] (let [ts (* ts 0.001)] (game-loop f (assoc game :delta-time (- ts (:total-time game)) :total-time ts))))))))