Great stuff about the timing guys!
I knew setTimeout isn't reliable, that's why i included:
Because that is actually how i discovered this behaviour, by clicking right at the time a tween finishes and starting a new tween in the click handler.
So the point wasn't really about timing or using setTimeout, i just used it in the example because it triggers the exact same behaviour as i had with my click handler (which is a little hard to demonstrate in JSFiddle )
In my case it was like an open/close toggle. Where onOpenClick adds content to an element and tweens it to become visible, and onCloseClick does kind of the reverse, it tweens to become invisible and onComplete removes the content from the element.
So when clicking right around the time the close tween ends, caused the open tween to .. well tween but after that tween started (/was created), the onComplete of the close tween was called which removed content from the element. So it tweened open with empty content.
Your post explains the behaviour perfectly
There's probably precisely one 'tick' difference (in one way or another) in the starting & rendering (thereby overwriting) of the second tween in which the first one finishes (calling the onComplete).
Perfect! That indeed solves the issue.
So i guess i'll use this in every tween where i use other tweens on the same target with an onComplete handler.
Thanks!