Skip to content

Instantly share code, notes, and snippets.

@ianb
Created March 11, 2015 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianb/169a2b5eaa9344c55cc5 to your computer and use it in GitHub Desktop.
Save ianb/169a2b5eaa9344c55cc5 to your computer and use it in GitHub Desktop.
function onButtonClicked() {
console.log("yay, click!");
}
document.getElementById("button").addEventListener("click", function () {
TogetherJS.send({type: "myButtonClick"});
onButtonClicked();
}, false);
TogetherJS.hub.on("myButtonClick", function () {
onButtonClicked();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment