Skip to content

Instantly share code, notes, and snippets.

@ondrej-kvasnovsky
Created March 3, 2018 23:41
Show Gist options
  • Select an option

  • Save ondrej-kvasnovsky/24a758eb0b1d03d922033f65185764f0 to your computer and use it in GitHub Desktop.

Select an option

Save ondrej-kvasnovsky/24a758eb0b1d03d922033f65185764f0 to your computer and use it in GitHub Desktop.
function init() {
registerHandler();
}
let eventBus;
function registerHandler() {
eventBus = new EventBus('http://localhost:8080/eventbus');
eventBus.onopen = function () {
eventBus.registerHandler('out', function (error, message) {
const counter = message.body;
document.getElementById('current_value').innerHTML = counter;
});
}
}
function increment() {
eventBus.send('in')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment