Search code examples
chromecasttic-tac-toe

window.gameEngine in tictactoe.html?


In Google's GitHub resources, there's a 'TicTacToe' receiver. In the tictactoe.html file, on line 38, there's this line: window.gameEngine = new cast.TicTacToe(mBoard);

I'm trying to understand what exactly 'gameEngine' is. It's not referenced anywhere else in the code, or other files. Could someone help explain the purpose of putting the TicTacToe object in 'gameEngine'?


Solution

  • That line is creating a new instance of cast.TicTacToe and assigning that to window.gameEngine so later on it can be accessed from anywhere needed.