mirror of
https://github.com/videojs/video.js.git
synced 2024-12-12 11:15:04 +02:00
2878c1d0d4
This new events function allows you to listen to a list of events and know that only one handler will ever be called for the group. With just one event, it'll function similarly to `.one`. Examples: Single event ``` const player = videojs('some-player-id'); player.any('a', (e) => console.log(e.type + ' triggered'); player.trigger('a'); // logs 'a triggered' player.trigger('a'); // logs nothing as the listener has been removed. ``` Multiple Events ``` const player = videojs('some-player-id'); player.any(['a', 'b', 'c', 'd'], (e) => console.log(e.type + ' triggered'); player.trigger('d'); // logs 'd triggered' player.trigger('a'); player.trigger('b'); player.trigger('c'); player.trigger('d'); // all triggers above log nothing as the listener is removed after the first 'd' trigger. ``` |
||
---|---|---|
.. | ||
evented.test.js | ||
stateful.test.js |