lundi 19 décembre 2016

how to deal with custom events in ember.js component?

I'm new to Ember.js and I've got some problems to understand its philosophy. I know actions up, data down but in real life, lets say I have Fotorama initialized in my-gallery component (I don't know if that is ok, but I did it in didInsertElement method). This library has its own events. They could look like this in plain JS:

$('.fotorama').on('fotorama:ready', function (e, fotorama) {});

or:

$('.fotorama').on('fotorama:show', function () {});

but I feel in Ember, those should be somehow mapped into actions in component. My question is: how? I need to fire some actions (to be catched by another components or maybe a router) inside those actions. So I think it should be like this: this.sendAction('actionName', actionParams);




Aucun commentaire:

Enregistrer un commentaire