Created
October 14, 2008 00:21
-
-
Save nesquena/16631 to your computer and use it in GitHub Desktop.
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
# example of my desired syntax for behaviors in red | |
# /public/javascripts/red/example.red | |
class ExampleBehavior < Behavior | |
def initialize(options={}) | |
self.something = 5 | |
end | |
def on_click(event) | |
self.element.hide | |
# ... more stuff | |
end | |
def on_mouseover(event) | |
self.element.set_style(:background_color, 'red') | |
end | |
def on_mouseout(event) | |
self.element.set_style(:background_color, 'gray') | |
end | |
end | |
document.bind('ready') do | |
document.select('div.example').apply(ExampleBehavior) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment