Skip to content

Instantly share code, notes, and snippets.

@searls
Created January 30, 2012 19:14
Show Gist options
  • Select an option

  • Save searls/1706073 to your computer and use it in GitHub Desktop.

Select an option

Save searls/1706073 to your computer and use it in GitHub Desktop.
class SerializableView extends Backbone.View
render: (layout) ->
if layout
layout(@).render(@serialize?() or @serialize).then =>
_.defer => @trigger('rendered')
else
$(@el).html(JST[@template](@serialize?() or @serialize))
@trigger('rendered')
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment