Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created January 2, 2012 18:54
Show Gist options
  • Save bmarini/1551711 to your computer and use it in GitHub Desktop.
Save bmarini/1551711 to your computer and use it in GitHub Desktop.
Half-assed port of event-map feature from backbone
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