Permalink
Browse files

Take the latency in account

  • Loading branch information...
1 parent 13c0289 commit 1744525a02fe922905c038e9f585e8e41b68d485 @sylvainmathieu committed Oct 2, 2011
Showing with 7 additions and 10 deletions.
  1. +1 −1 app/controllers/GameOfLife.java
  2. +6 −9 public/javascripts/game-of-life/game.coffee
@@ -17,7 +17,7 @@ public static void index() {
public static void saveGrid(Grid grid) {
grid.save();
- renderJSON(grid);
+ renderText(grid.id);
}
public static void getGrid(Long id) {
@@ -89,21 +89,18 @@ loadGrid = ->
drawGrid()
start = ->
- started = true
-
$.ajax
type: "post"
url: window.saveGrid()
data:
"grid.session": window.sessionUnique
"grid.grid": compact()
- dataType: "json"
- success: (grid) ->
- window.location.hash = "#" + grid.id
-
- speed = 100
- $(".fastforward").removeClass("on")
- intervalId = setInterval(tick, speed)
+ success: (gridId) ->
+ window.location.hash = "#" + gridId
+ speed = 100
+ $(".fastforward").removeClass("on")
+ started = true
+ intervalId = setInterval(tick, speed)
stop = ->
clearInterval(intervalId) if started

0 comments on commit 1744525

Please sign in to comment.