jeudi 29 octobre 2015

Ember: hooking into ActionHandler#send

I am trying to instrument this.send() in Ember, by hooking into ActionHandler#send as follows:

Ember.ActionHandler.reopen({
  send() { console.log("hooked"); this._super(...arguments); }
}

When I call this from app.js, as the app is starting up, it works. When I call it from an initializer, it does not. When I call it after the app starts up, such as from the application controller, it doesn't work either. In both cases where it doesn't work, if I trace into a this.send() call, it goes directly into the original implementation of send.

I have a suspicion this has something to do with the way mixins are used when instantiating objects, but otherwise I'm stumped.




Aucun commentaire:

Enregistrer un commentaire