Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Use :init for update functions instead of re-using :state atom.

  • Loading branch information...
commit b0168212c11f492fbcd0f0e556215a6548c14506 1 parent ec6f024
@technomancy authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/quil/applet.clj
7 src/quil/applet.clj
@@ -165,7 +165,7 @@
The return value of this function will become the new
:state, much like reduce. Takes precedence over :draw.
- :state - Initial value of the state passed to the :update fn.
+ :init - Initial value of the state passed to the :update fn.
:focus-gained - Called when the sketch gains focus.
@@ -233,6 +233,7 @@
focus-gained-fn (or (:focus-gained options) (fn [] nil))
focus-lost-fn (or (:focus-lost options) (fn [] nil))
state (atom (:state options))
+ init (atom (:init options))
target-obj (atom nil)
prx-obj (proxy [processing.core.PApplet
clojure.lang.IMeta] []
@@ -320,8 +321,8 @@
- ([] (swap! state (partial update-fn
- (.frameCount this))))))]
+ ([] (swap! init (partial update-fn
+ (.frameCount this))))))]
(applet-run prx-obj title renderer target)

0 comments on commit b016821

Please sign in to comment.
Something went wrong with that request. Please try again.