mixin (object) private
RSVP.EventTarget.mixin
extends an object with EventTarget methods. For Example:
var object = {}; RSVP.EventTarget.mixin(object); object.on('finished', function(event) { // handle event }); object.trigger('finished', { detail: value });
EventTarget.mixin
also works with prototypes:
var Person = function() {}; RSVP.EventTarget.mixin(Person.prototype); var yehuda = new Person(); var tom = new Person(); yehuda.on('poke', function(event) { console.log('Yehuda says OW'); }); tom.on('poke', function(event) { console.log('Tom says OW'); }); yehuda.trigger('poke'); tom.trigger('poke');
Parameters:
-
object
Object
- object to extend with EventTarget methods
Please login to continue.