Skip to content

Instantly share code, notes, and snippets.

@Sose
Created May 19, 2021 06:59
Show Gist options
  • Save Sose/c20a64b64b64b47fde7183e4932b9885 to your computer and use it in GitHub Desktop.
Save Sose/c20a64b64b64b47fde7183e4932b9885 to your computer and use it in GitHub Desktop.
(defn start-playing-turtle! []
(let [start-playing (get-in @state/app-state [:turtle :playing])]
(if start-playing
(let [interval-id (js/setInterval turtle-step! 1000)]
(swap! state/app-state assoc-in [:turtle :playing-id interval-id]))
(let [interval-id (get-in @state/app-state [:turtle :playing-id])]
(js/console.log (str interval-id))
(js/clearInterval interval-id)
(swap! state/app-state assoc-in [:turtle :playing-id] nil)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment