Add optional argument to Ads.trigger (currently only used for adblocker error)
This commit is contained in:
parent
e206edc1f6
commit
ef27ba16f4
@ -50,8 +50,9 @@ class Ads {
|
|||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// Script failed to load or is blocked
|
// Script failed to load or is blocked
|
||||||
this.trigger('ERROR');
|
const message = 'Google IMA SDK failed to load';
|
||||||
this.player.debug.error('Google IMA SDK failed to load');
|
this.trigger('ERROR', new Error(message));
|
||||||
|
this.player.debug.error(message);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.ready();
|
this.ready();
|
||||||
@ -518,13 +519,13 @@ class Ads {
|
|||||||
* Handles callbacks after an ad event was invoked
|
* Handles callbacks after an ad event was invoked
|
||||||
* @param {string} event - Event type
|
* @param {string} event - Event type
|
||||||
*/
|
*/
|
||||||
trigger(event) {
|
trigger(event, ...args) {
|
||||||
const handlers = this.events[event];
|
const handlers = this.events[event];
|
||||||
|
|
||||||
if (utils.is.array(handlers)) {
|
if (utils.is.array(handlers)) {
|
||||||
handlers.forEach(handler => {
|
handlers.forEach(handler => {
|
||||||
if (utils.is.function(handler)) {
|
if (utils.is.function(handler)) {
|
||||||
handler.call(this);
|
handler.apply(this, args);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user