Recursive Call with goog.dom.animationFrame

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Recursive Call with goog.dom.animationFrame



I am trying to use google closure animationFrame feature.
I would like to create an animation task with it and to call that created task recursively.



I defined a def named animationTask.
When I try to use that def recursively in that task it fails. It logs out that animationTask is undefined and thus can not be used as a function.



enter image description here



Could anyone point me in the right direction please?
I feel like I am missing some basic clojure knowledge here.





You are calling (animationTask) as a function, but is not defined as such. You should define it using (defn animationTask ...)
– ChrisBlom
yesterday







i don't think that's it. ganimation/createTask does produce a function
– Aurélien Bottazini
yesterday





Do you want the value under :measure to be a function? In other words, replace do with fn [state]? (Same argument for :mutate)
– Mike Fikes
yesterday




:measure


do


fn [state]


:mutate





Please post all code dirextly here as text.
– Carcigenicate
yesterday





As an aside, you will probably want to use #js on the argument being passed to ganimation/createTask, otherwise you are passing a persistent map instead of a JavaScript object.
– Mike Fikes
yesterday


#js


ganimation/createTask




1 Answer
1



Your code is calling the animation task function before it is defined. It is analogous to this simpler code:


(defn create [x] (fn ))

(def task (create {:measure (task)}))



If you try that in a REPL, you'll see that task is being called while it is still undefined.


task



Instead, the value under :measure is supposed to be a function, and the API takes a JavaScript object. This would be analogous to revising the above example to be:


:measure


(def task (create #js {:measure (fn [state] (task))}))






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Keycloak server returning user_not_found error when user is already imported with LDAP

PHP parse/syntax errors; and how to solve them?

How to scale/resize CVPixelBufferRef in objective C, iOS