Skip to content

Commit

Permalink
listening in the browser
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowdHailer committed May 28, 2018
1 parent a50bf80 commit ae199c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/watercooler/public/main.js
@@ -1 +1,9 @@
console.log("Hello")
var $message = document.getElementById('messages') // 1.

displayUpdate = function (update) { // 2.
var line = "<li>" + update.data +"</li>"
$message.innerHTML = line + $message.innerHTML
}
var source = new EventSource('/listen'); // 3.

source.onmessage = displayUpdate // 4.

0 comments on commit ae199c8

Please sign in to comment.