mardi 21 novembre 2017

Remove a particular event listener in EmberJS

I would like to only listen the first didRender in a EmberJS Component.

initialDidRender: Ember.on('didRender', function() {
    // Do some stuff

    this.off('didRender');
}),

allOtherDidRender: Ember.on('didRender', function() {
    // Do some stuff
})

Using this.off works great for my usecase but if I want to define another didRender listener in the future, it will also remove that one.

Is there a way to only disable initialDidRender of my example?

I also tried this.set('initialDidRender', null); but it throw error on future didRender events.




Aucun commentaire:

Enregistrer un commentaire