Skip to content

Commit 4fbbf17

Browse files
committed
refresh game state on interval
1 parent f79ccf5 commit 4fbbf17

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

public/app/gameController.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var module = angular.module('scorekeep');
22
module.controller('GameController', Game);
3-
function Game($scope, $http, $routeParams, SessionService, UserService, GameService, GameCollection, RulesService, StateService, api) {
3+
function Game($scope, $http, $interval, $routeParams, SessionService, UserService, GameService, GameCollection, RulesService, StateService, api) {
44
$scope.game = new GameService;
55
$scope.state = new StateService; // game state object
66
$scope.gamestate = []; // game state as Array
@@ -19,6 +19,9 @@ function Game($scope, $http, $routeParams, SessionService, UserService, GameServ
1919
});
2020
}
2121
$scope.playgame();
22+
$scope.interval = $interval(function(){
23+
$scope.playgame();
24+
}, 5000);
2225

2326
$scope.move = function(cellid){
2427
console.log("MOVE on cell " + cellid);
@@ -53,4 +56,5 @@ function Game($scope, $http, $routeParams, SessionService, UserService, GameServ
5356
$scope.gamestate = $scope.state.state.split('');
5457
});
5558
}
59+
5660
}

0 commit comments

Comments
 (0)