Skip to content

Instantly share code, notes, and snippets.

@gkatsev
Created December 8, 2014 19:22
Show Gist options
  • Save gkatsev/c49352e19af2a83525b1 to your computer and use it in GitHub Desktop.
Save gkatsev/c49352e19af2a83525b1 to your computer and use it in GitHub Desktop.
vjs.EventEmitter = function() {
};
vjs.EventEmitter.prototype.allowedEvents_ = {
};
vjs.EventEmitter.prototype.on = function(type, fn) {
vjs.on(this, type, fn);
};
vjs.EventEmitter.prototype.off = function(type, fn) {
vjs.off(this, type, fn);
};
vjs.EventEmitter.prototype.one = function(type, fn) {
vjs.one(this, type, fn);
};
vjs.EventEmitter.prototype.trigger = function(event) {
var type = event.type || event;
if (this.allowedEvents_[type] && this['on' + type]) {
this['on' + type]();
}
vjs.trigger(this, event);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment