0

I built a chrome extension for the Github Star page using jQuery and Backbone. You can try it here: https://chrome.google.com/webstore/detail/gpmgjficglcobhpbbkbgklfcpmhpemnb and the source code is here: https://github.com/gregorym/galactic

My problem is the following, on the page I inserted a text field which filters the repositories. But sometimes when I type too fast my events are triggered but are not caught...

Here the code triggering the events: https://github.com/gregorym/galactic/blob/master/app/views/stars/search.js#L25

And here is the code that is supposed to catch them: https://github.com/gregorym/galactic/blob/master/app/views/stars/index.js#L14

Any idea what could be causing the problem?

Thanks, Greg

Gregory
  • 557
  • 6
  • 17

1 Answers1

0

Your listener is on self which is a Backbone view, but you trigger on a jQuery element. Both trigger and listener must be on the same element that extends Backbone.Events.

PS looks like you namespace everything using name.space = name.space || {} -- you'd be better off implementing a namespace function, e.g. ns('name.space.foo') or ns('app.views.Home', Backbone.View.extend({...})

mvbl fst
  • 5,213
  • 8
  • 42
  • 59
  • PS I said "extends Backbone.Events", just to be clear - views, models, collections and router all extend Backbone.Events. – mvbl fst Aug 28 '12 at 01:31