Skip to content

Instantly share code, notes, and snippets.

@hsienwei
Created May 19, 2014 02:48
Show Gist options
  • Save hsienwei/b232fa188603c7b928ac to your computer and use it in GitHub Desktop.
Save hsienwei/b232fa188603c7b928ac to your computer and use it in GitHub Desktop.
HTMLActuator.prototype.message = function (won) {
var type = won ? "game-won" : "game-over";
var message = won ? "You win!" : "Game over!";
this.messageContainer.classList.add(type);
this.messageContainer.getElementsByTagName("p")[0].textContent = message;
window.messageBus.send(window.senderId, won ? "win" : "lose");
};
HTMLActuator.prototype.clearMessage = function () {
// IE only takes one value to remove at a time.
this.messageContainer.classList.remove("game-won");
this.messageContainer.classList.remove("game-over");
window.messageBus.send(window.senderId, "clear");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment