Commits

Sean Wilkinson committed 7b0265c

Tied into GUI events and added network status listener

Comments (0)

Files changed (2)

couchdb-app/_attachments/gui.js

 //
 //                                                      ~~ (c) SRW, 02 Nov 2011
 
-//- (n/a)
+(function (global) {
+    'use strict';
+
+ // Assertions
+
+    if (global.hasOwnProperty('window') === false) {
+        throw new Error('The GUI targets web browsers only.');
+    }
+
+ // Private declarations
+
+    var silencer, window;
+
+ // Private definitions
+
+    silencer = function (evt) {
+     // (placeholder)
+    };
+
+    window = global.window;
+
+ // Private constructors
+
+ // Global definitions
+
+    if (window.hasOwnProperty('applicationCache')) {
+        window.applicationCache.oncached = silencer;
+        window.applicationCache.onchecking = silencer;
+        window.applicationCache.ondownloading = silencer;
+        window.applicationCache.onerror = silencer;
+        window.applicationCache.onnoupdate = silencer;
+        window.applicationCache.onobsolete = silencer;
+        window.applicationCache.onprogress = silencer;
+        window.applicationCache.onupdateready = silencer;
+    }
+
+    window.onoffline = window.ononline = function (evt) {
+        console.log('Are we online? ' + navigator.onLine);
+    };
+
+ // That's all, folks!
+
+    return;
+
+}(function (outer_scope) {
+    'use strict';
+ // This strict anonymous closure is taken from my Web Chassis project.
+    /*global global: true */
+    if (this === null) {
+        return (typeof global === 'object') ? global : outer_scope;
+    } else {
+        return (typeof this.global === 'object') ? this.global : this;
+    }
+}.call(null, this)));
 
 //- vim:set syntax=javascript:

couchdb-app/_attachments/index.html

     </ul>
     <script src="./quanah.js"></script>
     <script src="./fs.js"></script>
+    <script src="./gui.js"></script>
   </body>
 </html>