aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2018-03-11 10:55:29 +1100
committerGitHub <noreply@github.com>2018-03-11 10:55:29 +1100
commit9a0c1c830dde9774023429bbc2e7a6f61c08b661 (patch)
tree64796f3bea13c09d45006da2a8fbbe8be691fb70 /src/js
parente206edc1f6a09e6c2584e83a60d2632202545733 (diff)
parentef27ba16f4d1e8520c90cecf9e945b1edebb7ec0 (diff)
downloadplyr-9a0c1c830dde9774023429bbc2e7a6f61c08b661.tar.lz
plyr-9a0c1c830dde9774023429bbc2e7a6f61c08b661.tar.xz
plyr-9a0c1c830dde9774023429bbc2e7a6f61c08b661.zip
Merge pull request #804 from friday/ads-trigger-arguments
[v3] Add optional arguments to Ads.trigger
Diffstat (limited to 'src/js')
-rw-r--r--src/js/plugins/ads.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js
index 5cf743c2..82599594 100644
--- a/src/js/plugins/ads.js
+++ b/src/js/plugins/ads.js
@@ -50,8 +50,9 @@ class Ads {
})
.catch(() => {
// Script failed to load or is blocked
- this.trigger('ERROR');
- this.player.debug.error('Google IMA SDK failed to load');
+ const message = 'Google IMA SDK failed to load';
+ this.trigger('ERROR', new Error(message));
+ this.player.debug.error(message);
});
} else {
this.ready();
@@ -518,13 +519,13 @@ class Ads {
* Handles callbacks after an ad event was invoked
* @param {string} event - Event type
*/
- trigger(event) {
+ trigger(event, ...args) {
const handlers = this.events[event];
if (utils.is.array(handlers)) {
handlers.forEach(handler => {
if (utils.is.function(handler)) {
- handler.call(this);
+ handler.apply(this, args);
}
});
}