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.

Repeating actions ("every")

Action commands can be made to run every half a second, every second, etc.

You do this with the "every" parameter in the action command.

For example:

render-before-end: "hello " every 1s;

Each action clause can have its own "every" parameter.

For example:

render-before-end: "hello " every 1s, "dude " every 2s;
Using "every" with an "after" parameter

"After" parameters always run first, and they always run once. "Every" parameters run second and keep running.

But put "after" at the end of the line. This will make sense to you when you read the example below.

For example:

render-before-end: "hello " every 1s after 500ms, "dude " every 2s after 500ms;

The actions above happen after the first 500ms. It does the same thing as the previous example, but there is a delay of half a second before it starts.

Using with CSS commands

You can even use both "after" and "every" with regular CSS commands! It shouldn't clash, as both parameters gets stripped out of the CSS command before the browser processes it.

Cancelling "every" actions

You can cancel "every" actions at any time. If you are using an "after" parameter, when you cancel that then you cancel the "every" that follows it at the same time. You can either cancel a general action, or you can target a specific action by assigning a label to the action itself and then cancelling by label.

So cancelling an "every" is exactly the same as cancelling an "after". Hence for simplicity the cancelling of delayed and intervaled actions is one command - "cancel-timer".

To find out more, see the "cancel-timer", or "cancel-timer-all" action commands.