Skip to content

Instantly share code, notes, and snippets.

@danielfarrell
Created May 1, 2012 17:36
Show Gist options
  • Save danielfarrell/2569905 to your computer and use it in GitHub Desktop.
Save danielfarrell/2569905 to your computer and use it in GitHub Desktop.
BackSupport.Preventable = (object) ->
prototype = object.prototype
init = prototype.initialize
prototype.initialize = ->
if @preventable
_.each @preventable, (func) =>
@[func] = _.wrap @[func], (func, e) =>
e.preventDefault()
func = _.bind func, @
func(e)
if init?
((scope)->
init = _.bind init, scope
init()
)(@)
object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment