"use strict";
const connection = new wfc.Connection("ws://127.0.0.1:8080/westfield");
connection.registry.listener.global = (name, interface_, version) => {
    if (interface_ === "example_global") {
        const exampleGlobal = connection.registry.bind(name, interface_, version);
        const exampleClock = exampleGlobal.create_example_clock();
        exampleClock.listener.time_update = (time) => {
            document.getElementById("the_time").innerHTML = time.toString();
        };
    }
};
@@ -78,16 +78,39 @@
 field%22);
+//connect to the server
 %0Aconnect
@@ -168,24 +168,89 @@
 ersion) =%3E %7B
+//register a listener to will be notified if a new global appears
 %0A    if (int
@@ -280,16 +280,48 @@
 obal%22) %7B
+//check if we support the global
 %0A       
@@ -395,16 +395,70 @@
 ersion);
+//create a new object that will be bound to the global
 %0A       
@@ -516,16 +516,43 @@
 clock();
+//create a new clock object
 %0A       
@@ -599,16 +599,41 @@
 me) =%3E %7B
+//listen for time updates
 %0A       
@@ -701,16 +701,31 @@
 tring();
+//show the time
 %0A       

add comments to js example