I have an infinite scroller that adds new elements to a page as the user scrolls. I would like to have multiple subscribers be able to bind to an event that I fire every time the new elements are added.
Is it possible for me to raise a custom event like I can in Backbone?
For example in backbone I can create an evented model like this:
this.vent = _.extend({}, Backbone.Events);
I can then bind events like this:
this.vent.bind('my:custom:event', this.handler);
And I can then fire them like this:
this.trigger('my:custom:event', args);
Can I use Ember.evented like this or is there a better way?
If you would like Ember.js to recognize the events, you can add those events to your App definition. Check out this Understanding Ember.js article, right below the list of "included" events.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With