I have recently started switching from syntax like this:
Ember.Object.extend({
someMethod: function(){
// do something
}.on('init')
});
to this:
Ember.Object.extend({
someMethod: Ember.on('init', function() {
// do something
})
});
Because it seems to be the convention nowadays and I hear it works better in add-ons.
However, occasionally I want to chain behaviors of the method like this:
Ember.Object.extend({
someMethod: function(){
// do something
}.on('init').observes('someProperty')
});
Is there a way to achieve this with the syntax that doesn't count on having function prototypes modified to include on
and observes
methods?
Aucun commentaire:
Enregistrer un commentaire