race

race

A race condition can occur between competing snippets, like snippets based on the same environment, or snippets that signal a winning strategy but can also stop executing.

The only conditional-hiding-snippet that does not support race is hide-if-canvas-contains.
The only behavioral-snippet that supports race is skip-video.

Parameters

Name

Description

Mandatory

race start;

Begins a race, passing an arbitrary amount of winners (default: 1).

Yes

race stop;

Stops a race.

Yes

Filter examples

example.com#$#race start; snippet 1 2 3; other 4 5 6; another 7 8 9; race stop;
example.com#$#race start 2; first 1; second 2; third 3; fourth 4; race stop;

A snippet wins the race, and all others are flagged as losers. A registered callback to stop losing snippets from executing is then invoked.

Other resources