Skip to content

Instantly share code, notes, and snippets.

@JonMidhir
Last active December 23, 2015 17:29
Show Gist options
  • Select an option

  • Save JonMidhir/6668921 to your computer and use it in GitHub Desktop.

Select an option

Save JonMidhir/6668921 to your computer and use it in GitHub Desktop.
class ShiftDock.Views.RotasIndex extends Backbone.View
# ...
initialize: ->
@collection.on 'fetched', @render, this
render: ->
# ...
# ...
class ShiftDock.Routers.Rotas extends Backbone.Router
# ...
index: (year, week) ->
@collection.fetch
success: (collection, response) =>
collection.trigger('fetched')
# ...
@JonMidhir
Copy link
Author

This is probably not ideal, comes from way back when I started porting the thing over to Backbone. Nothing wrong with triggering custom events, it's just that I'm sure there must be a built in fetch event somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment