cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Cordova Wiki] Update of "InAppBrowserTest" by ShazronAbdullah
Date Mon, 10 Dec 2012 22:15:41 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cordova Wiki" for change notification.

The "InAppBrowserTest" page has been changed by ShazronAbdullah:
http://wiki.apache.org/cordova/InAppBrowserTest?action=diff&rev1=1&rev2=2

Comment:
Added events tests

                  };
              }
              
+ 			var iabRef = null;
+ 			
              function launchUrl() {
                  try {
                      var url = document.getElementById("windowUrl").value;
@@ -19, +21 @@

                          url = 'http://' + url;
                      }
                      
-                     window.open(url, target, "location=" + (showLocationbar? "yes":"no"));
+                     iabRef = window.open(url, target, "location=" + (showLocationbar? "yes":"no"));
+                     iabRef.addEventListener('loadstart', onLoadStart);
+                     iabRef.addEventListener('loadstart', onLoadStop);
+                     iabRef.addEventListener('exit', onExit);
                  
                  } catch (e) {
                      alert(e);
@@ -42, +47 @@

                  
                  btn.disabled = (txt.value.length == 0);
              }
+ 			
+             function onLoadStart(event) {
+                 alert(event.type + ' - ' + event.url);
+             }
+ 
+             function onLoadStop(event) {
+                 alert(event.type + ' - ' + event.url);
+             }
+ 
+             function onExit(event) {
+                 alert(event.type);
+                 if (iabRef) {
+                     iabRef.removeEventListener('loadstart', onLoadStart);
+                     iabRef.removeEventListener('loadstart', onLoadStop);
+                     iabRef.removeEventListener('exit', onExit);
+                     iabRef = null;
+                 }
+             }
              
          </script>
          <div style="margin-left:10px">

Mime
View raw message