I’m using Ember CLI 1.13 and I’m attempting to create a router mixin in an addon that binds to the willTransition
hook, but the issue I’m encountering is not limited to this event.
At this point the mixin looks like such:
import Ember from 'ember';
export default Ember.Mixin.create({
genericFunction: function(transition) {
console.log('--- generic function ---');
}.on('willTransition')
});
When attempting to run the dummy app utilising the mixin, I get the following error:
Uncaught TypeError: (intermediate value)(intermediate value)(intermediate value).on is not a function
When including and using the addon in a separate application, there are no errors and everything functions as expected. There are no warnings, errors, anything else to hint towards any issues with its use in a full application.
The environment config of the dummy app and the separate application are identical, so I’ve ruled out environment config as a potential issue.
I’m not sure whether or not this is just broken functionality in Ember or whether I’m required to take some additional steps to make the dummy app behave as you’d expect it to when using hooks/events.
Any help would be greatly appreciated.
Thanks!