Looking for the old docs? Go here

Helpers

Event Triggers

Helpful methods when working with event triggers.

All events dispatched by the player contain a triggers property which is a EventTriggers class instance. It stores a history of events that were responsible for triggering the event it was stored on. For example, media-play-request will lead to play being fired, hence it’s referred to as a “trigger.” Below you’ll find methods that can be used to modify or inspect the trigger event chain.

Appends the given event to the chain. The origin of the appended event will become the new origin.

    
    

Removes the event from the chain and returns it (if found).

    
    

Whether the chain contains the given event.

    
    

Whether an event with the given type exists in the chain.

    
    

Whether an event with the given type exists in the chain. If found, the event will be returned.

    
    

Walks an event chain, and invokes the given callback for each trigger event. If a value is returned by the callback, the walk will end and [event, value] will be returned.