Skip to content

Instantly share code, notes, and snippets.

@mainameiz
Created January 14, 2014 11:36
Show Gist options
  • Save mainameiz/8416949 to your computer and use it in GitHub Desktop.
Save mainameiz/8416949 to your computer and use it in GitHub Desktop.
class View
lol: ->
console.log "view lol"
console.log @
class Foo
@delegate: (method, obj) ->
console.log "delegating #{method} to #{obj}"
console.log @::
@::[method] = ((obj, method) ->
-> @[obj][method].apply(@, arguments)
)(obj, method)
console.log "2"
console.log @::
fooLol: -> console.log "fooLol"
class Bar extends Foo
@delegate("lol", "view")
constructor: ->
@view = new View()
#console.log "3"
#console.log Bar.prototype
b = new Bar()
#console.log Bar.prototype
b.lol()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment