Example 1:
After creating a full-page fancy confirmation overlay animation with the new interactions, it would be nice to be able to have that animation begin when some input is submitted and is executed successfully in the back-end. In this case, JS code would be waiting for the confirmation from the back-end and will then trigger the animation to start (i.e. there would be no way to trigger this as a user without having received the confirmation from the back-end)
Example 2:
Imagine a complex animation that the user needs to see every time but the last few parts of that animation need to be shown once (i.e. the animation needs to stop short of finishing if there's a page refresh). Using JS and session tokens, you set up to functions called seenAnimation, which returns true or false. Now you can add a step in your animation calling seenAnimation during the animation run time. The attributes would be "continue if function returns true" and "stop animation if function returns false".