Skip to content

Commit

Permalink
Merge pull request sampotts#703 from gurupras/early-listener-fix
Browse files Browse the repository at this point in the history
Allow Plyr.setup event listeners to be set up as separate event listeners
  • Loading branch information
Sam Potts committed Nov 4, 2017
2 parents c64dace + 95734cf commit adfe23a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/js/plyr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit adfe23a

Please sign in to comment.