Created
September 18, 2012 10:59
-
-
Save geraldalewis/3742581 to your computer and use it in GitHub Desktop.
Do does
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Frame | |
constructor: (@elements) -> | |
methods = ['remove', 'show', 'hide', 'stop'] | |
for method in methods | |
do (method) -> | |
Frame::[method] = -> | |
element[method]() for element in @elements | |
class El | |
constructor: (@name) -> | |
remove: -> console.log("remove called on #{@name}") | |
show: -> console.log("show called on #{@name}") | |
hide: -> console.log("hide called on #{@name}") | |
stop: -> console.log("stop called on #{@name}") | |
el1 = new El("El1") | |
el2 = new El("El2") | |
el3 = new El("El3") | |
f = new Frame [el1, el2, el3] | |
f.remove() | |
f.show() | |
f.hide() | |
f.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment