rx-player
Version:
Canal+ HTML5 Video Player
29 lines (28 loc) • 710 B
JavaScript
export default class CoreInterface {
constructor() {
this.listeners = [];
this.listenersError = [];
}
addMessageListener(cb) {
this.listeners.push(cb);
}
removeMessageListener(cb) {
const index = this.listeners.indexOf(cb);
if (index >= 0) {
this.listeners.splice(index, 1);
}
}
addErrorListener(cb) {
this.listenersError.push(cb);
}
removeErrorListener(cb) {
const index = this.listenersError.indexOf(cb);
if (index >= 0) {
this.listenersError.splice(index, 1);
}
}
dispose() {
this.listeners.length = 0;
this.listenersError.length = 0;
}
}