Implement javascript-game communication