There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.
Close

Processing...
This may take a few seconds.

trigger-fresh

Syntax

trigger-fresh: (event) [every (time)] [after (time)][, (event)...];

Works like the trigger command.

What this does though is fix any potential memory leak when you need a loop and can use a trigger command to trigger the sequence each time. Use trigger-fresh to cleanly trigger an event when you don't need to remember which event you came from. Variables are still available, however, as these are not part of the event stack.

In the core, the trigger-fresh does a JavaScript setTimeout and then runs the appropriate event. This effectively breaks out of the event stack and starts a brand new event.

In the regular trigger command, there is a continuous flow, and no setTimeout. This is more useful for keeping an eye on the command stack to keep things running in sequence, but not for infinite loops, because you will run into memory issues. Use trigger-fresh to get a "fresh" trigger, and you can keep an infinite loop running indefinitely.