From 1924f35d1d21a59939110f7eae238052c37474e2 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Thu, 10 Oct 2013 17:28:21 +0200 Subject: Some more comments --- apps/samples/miles/miles.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/samples/miles/miles.js b/apps/samples/miles/miles.js index 22d536a..860cd1e 100644 --- a/apps/samples/miles/miles.js +++ b/apps/samples/miles/miles.js @@ -25,6 +25,7 @@ function Miles(element, params) { if (params && params.email) email = params.email; if (params && params.problemName) problemName = params.problemName; + // called when dojo loaded all requirements below this.connect = function() { self.xhr.post({ // The URL to request @@ -51,6 +52,7 @@ function Miles(element, params) { }); } + // fetch a base64 encoded image and set it as the src attribute var refreshImage = function() { self.xhr.get({ // The URL to request @@ -91,10 +93,12 @@ function Miles(element, params) { ready(function() { self.xhr = xhr; + // if we were passed an id, resolve to dom node if (typeof(element) === 'string') { element = dom.byId(element); } + // dynamically assemble the DOM we need element.appendChild(domConst.toDom('\ \ \ @@ -117,6 +121,7 @@ function Miles(element, params) {
\ ')); + // from the above DOM, fetch some nodes to put dojo widgets in self.pictureElem = dojo.query("img.picture", element)[0]; self.controlElem = dojo.query("td.control", element)[0]; self.messageElem = dojo.query("div.messages", element)[0]; @@ -127,9 +132,9 @@ function Miles(element, params) { self.controlDropDown = new DropDownButton({ label: "Connect", dropDown: self.controlToolTip }); self.controlElem.appendChild(self.controlDropDown.domNode); - // self.connected = true; - // refreshImage(); - + // many more control widgets to be instantiated here + + // connect and start to fetch images from the server self.connect(); }) -- cgit v0.12