Created
January 2, 2012 18:54
-
-
Save bmarini/1551711 to your computer and use it in GitHub Desktop.
Half-assed port of event-map feature from backbone
This file contains 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 UI | |
container: null | |
events: { } | |
constructor: () -> | |
this.bindEvents() | |
bindEvents: () -> | |
for event_type_and_selector, callback of @events | |
[event_type, selector] = event_type_and_selector.split(' ') | |
class ChessBoard extends UI | |
container: ".chessboard" | |
events: | |
"click .back": "transitionBackward" | |
"click .next": "transitionForward" | |
"click .flip": "flipBoard" | |
transitionForward: () -> | |
transitionBackward: () -> | |
flipBoard: () -> | |
chessboard = new ChessBoard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment