1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-12 11:15:04 +02:00
Commit Graph

12 Commits

Author SHA1 Message Date
Brandon Casey
2878c1d0d4 feat(events): add any function (#5977)
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.
```
2019-06-17 14:04:25 -04:00
Brandon Casey
23a36f338b test: memory leak fixes in tests (#5861) 2019-03-18 15:49:48 -04:00
Gary Katsevman
6bff3ce779
fix(vjsstandard): update to 8.0.2 and fixup linting (#5413) 2018-09-28 14:58:15 -04:00
Gary Katsevman
9c4ded8899
fix(events): triggering with an object had incorrect target property on event object (#4993)
Currently, trigger an event with an object rather than a string will have the document as a target on the event object rather than the element.
2018-03-05 16:42:06 -05:00
Gary Katsevman
214e01c885 test(events): silence error logging in tests (#3835)
The error that is logged in this test makes it hard to see what is an actual error in some cases.
2016-12-05 16:22:49 -05:00
Gary Katsevman
fac52046f3 Merge branch 'stable' 2016-08-25 19:34:07 -04:00
Jon-Carlos Rivera
fdd8550307 @imbcmdth Added exception handling to event dispatcher. closes #3580
* Guard against exceptions in an event handler to stop them from breaking further processing of event handlers

* Added a test for try/catch behavior for exceptions originating in event handlers
2016-08-25 19:08:56 -04:00
Pat O'Neill
72c44daaf3 @misteroneill updated tests to qunit 2.0. closes #3509 2016-08-12 13:51:31 -04:00
Priti Agarwal
945711855a @pagarwal123 updated some test code to pass linter 2016-08-05 11:38:08 -04:00
Michelle Anderson
3479a545aa Checking on the event the relatedTarget exists before setting its property
Fixes a bug where relatedTarget was undefined in Firefox

fixes #2024
closes #2025
2015-07-09 15:41:07 -07:00
Carlos
55a391b54a @carpasse enhanced events to allow passing a second data argument. closes #2163 2015-06-05 10:36:59 -07:00
heff
a8ff970d4a Broke up Lib and Util into smaller libraries of functions
Broke out bind, guid, and element data functions from Lib

Separated out more dom functions in to dom.js

Broke out URL functions into url.js

Removed setLocalStorage since it wasn't being used

Moved browser tests out of lib

Moved log functions into their own file

Removed trim() since it wasn't being used

Moved formatTime into its own file

Moved round into its own file and renamed roundFloat()

Moved capitalize into its own file and renamed as toTitleCase()

Moved createTimeRange into its own file

Removed Lib.arr.forEach infavor of the native forEach

Removed Lib.obj.create in favor of native Object.create (ES6-sham)

Removed obj.each in favor of native Object.getOwnPropertyNames().forEach()

Removed obj.merge and copy. Using lodash.assign instead.

Replaced Lib.obj.isPlain with lodash.isPlainObject

Removed Lib.obj.isArray in favor of the native Array.isArray

Also removed the lib.js tests file as all tests have been moved
or removed.

Removed Lib.isEmpty in favor of !Object.getOwnPropertyNames().length

Switched Util.mergeOptions and deepMerge to use new mergeOptions()

Moved Lib.TEST_VID to Html5.TEST_VID

Removed Lib references everywhere. Woo!

Attempting to fix sourcemap test errors by setting grunt-browserify version

Switched to object.assign from lodash.assign

Removed unused 'inherits' dependency

Reorganzied test files and added '.test' to file names

Combined js/core.js and js/video.js

Moved events.js into the utils directory
2015-05-15 18:20:35 -07:00