1

It is well documented on how to add the custom paste event to an Ember Application. See custom events, as detailed in How to listen to a paste event on a textarea in emberjs.

My question is how do I achieve this in an Ember addon that I am writing? As I do not see a Ember.Application.create?

Community
  • 1
  • 1
Adam Knights
  • 2,141
  • 1
  • 25
  • 48

1 Answers1

0

I think this should go into the included hook of your addon index.js file.

The included hook will receive the app as an argument and then you should be able to set it's customEvents attribute like:

// index.js
module.exports = {
  name: 'your-addon',
  included: function(app, parentAddon) {
    app.customEvents = {
      paste: "paste"
    }
  }
};
Nazim
  • 367
  • 2
  • 11
  • Do I still need a ```this._super.included(app);``` in the included call? – Adam Knights Aug 23 '16 at 07:54
  • okay then could you try to create an instance-initializer in your addon and in the `initialize` function do someting like: application.customEvents = { paste: "paste" } – Nazim Aug 23 '16 at 10:43