Skip to content

Commit

Permalink
send moves to subscription object directly
Browse files Browse the repository at this point in the history
  • Loading branch information
schoblaska committed Jan 19, 2016
1 parent 2f21716 commit e169bb1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/board.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ $ ->
# illegal move
return "snapback"
else
$(document).trigger("made_move", move)
App.game.perform("make_move", move)

App.board = ChessBoard("chessboard", cfg)
4 changes: 0 additions & 4 deletions app/assets/javascripts/channels/game.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,5 @@ App.game = App.cable.subscriptions.create "GameChannel",
when "opponent_forfeits"
@printMessage("Opponent forfeits. You win!")

install: ->
$(document).on "made_move", (event, move) =>
@perform("make_move", move)

printMessage: (message) ->
$("#messages").append("<p>#{message}</p>")

0 comments on commit e169bb1

Please sign in to comment.