monet icon indicating copy to clipboard operation
monet copied to clipboard

What does an update function do?

Open rjb25 opened this issue 8 years ago • 1 comments

Lacking docs or links to docs on what an update function is and does.

rjb25 avatar Oct 18 '16 21:10 rjb25

It is a structured way to update the entities value. If you look here: https://github.com/rm-hull/monet/blob/master/src/monet/canvas.cljs#L344-L350 you can see it pulls out the value and update function, and update is called with the current value and the time delta since it was last called.

I guess the original intention was that an entity value might contain screen coordinates, which get updated periodically to create movement.

This stuff predates react and om (and my involvement, TBH) - I wrote a library called big-bang a while ago which does the same sort of event-loop abstraction, but it never got much (any?) traction, so sits there unmaintained and unloved.

I only ever used monet for the canvas wrapper functions. I've half a mind to remove the entity stuff altogether, actually.

rm-hull avatar Oct 19 '16 21:10 rm-hull