How do you bind views to third party library events?

How can you bind to external events if you wrap let’s say a jquery ui plugin with an ember view?

I tried doing this:

App.SomeView = Ember.View.extend({
    classNames: ['some', 'classes'],
    templateName: 'some',
    didInsertElement: function() {
        this.$().on('external_event', this.someCallback);
    }
});

And this:

App.SomeController = Ember.ObjectController.extend({
    appendSomeView: function() {
        var view = App.SomeView.create();
        view.append();

        view.on('external_event', this.someCallback);
    }
});

But no luck, perhaps I’m doing something wrong?

My bad I was using the wrong event name by mistake, the first example does work.

don’t forget to remove the listener on willDestroyElement you don’t want to accidentally leak those unmanaged event handlers.

Thanks @stefan will do