RSVP.EventTarget#mixin()

mixin (object) private

Defined in bower_components/rsvp/lib/rsvp/events.js:24

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
doc_EmberJs
2016-11-30 16:53:22
Comments
Leave a Comment

Please login to continue.