diff options
author | Guru Prasad Srinivasa <gurupras@buffalo.edu> | 2017-11-01 04:15:01 -0400 |
---|---|---|
committer | Guru Prasad Srinivasa <gurupras@buffalo.edu> | 2017-11-01 04:15:03 -0400 |
commit | 95734cf7cc2d84893873325cb7ffe054f99aff3e (patch) | |
tree | 5a0174ce25cd4c4f344cd07499ff0fa0eb6afe6a | |
parent | b3759e966d96b4a9f3ed3f7795c42e611b63d104 (diff) | |
download | plyr-95734cf7cc2d84893873325cb7ffe054f99aff3e.tar.lz plyr-95734cf7cc2d84893873325cb7ffe054f99aff3e.tar.xz plyr-95734cf7cc2d84893873325cb7ffe054f99aff3e.zip |
Allow setup event listeners to be set up as separate event listeners
rather than in-conjunction with defaultListener
This allows the setup listeners to do things like
preventDefault()/stopImmediatePropagation() and have them work
-rw-r--r-- | src/js/plyr.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 4da34153..4a708d32 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -472,13 +472,21 @@ // Bind along with custom handler function _proxyListener(element, eventName, userListener, defaultListener, useCapture) { + if(userListener) { + // Register this before defaultListener + _on( + element, + eventName, + function(event) { + userListener.apply(element, [event]); + }, + useCapture + ); + } _on( element, eventName, function(event) { - if (userListener) { - userListener.apply(element, [event]); - } defaultListener.apply(element, [event]); }, useCapture |