cordova-app-loader
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -57,24 +57,24 @@ (function(){ | ||
// Load Next Script | ||
function loadScript(){ | ||
var src = scripts.shift(); | ||
if(!src) return; | ||
// Ensure the 'src' has no '/' (it's in the root already) | ||
if(src[0] === '/') src = src.substr(1); | ||
src = manifest.root + src ; | ||
// Load javascript | ||
if(src.substr(-3) === ".js"){ | ||
el= document.createElement('script'); | ||
el.type= 'text/javascript'; | ||
el.src= src + '?' + now; | ||
el.onload = loadScript; | ||
// Load CSS | ||
} else { | ||
el= document.createElement('link'); | ||
el.rel = "stylesheet"; | ||
el.href = src + '?' + now; | ||
el.type = "text/css"; | ||
setTimeout(loadScript,0); | ||
} | ||
head.appendChild(el); | ||
// Load Scripts | ||
function loadScripts(){ | ||
scripts.forEach(function(src) { | ||
if(!src) return; | ||
// Ensure the 'src' has no '/' (it's in the root already) | ||
if(src[0] === '/') src = src.substr(1); | ||
src = manifest.root + src ; | ||
// Load javascript | ||
if(src.substr(-3) === ".js"){ | ||
el= document.createElement('script'); | ||
el.type= 'text/javascript'; | ||
el.src= src + '?' + now; | ||
el.async = false; | ||
// Load CSS | ||
} else { | ||
el= document.createElement('link'); | ||
el.rel = "stylesheet"; | ||
el.href = src + '?' + now; | ||
el.type = "text/css"; | ||
} | ||
head.appendChild(el); | ||
}); | ||
} | ||
@@ -95,5 +95,5 @@ | ||
if(manifest.root.substr(0,7) === 'cdvfile'){ | ||
document.addEventListener("deviceready", loadScript, false); | ||
document.addEventListener("deviceready", loadScripts, false); | ||
} else { | ||
loadScript(); | ||
loadScripts(); | ||
} | ||
@@ -100,0 +100,0 @@ // Save to global scope |
{ | ||
"name": "cordova-app-loadaer", | ||
"main": "dist/CordovaAppLoader.js", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"homepage": "https://github.com/markmarijnissen/cordova-file-cache", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -57,24 +57,24 @@ (function(){ | ||
// Load Next Script | ||
function loadScript(){ | ||
var src = scripts.shift(); | ||
if(!src) return; | ||
// Ensure the 'src' has no '/' (it's in the root already) | ||
if(src[0] === '/') src = src.substr(1); | ||
src = manifest.root + src ; | ||
// Load javascript | ||
if(src.substr(-3) === ".js"){ | ||
el= document.createElement('script'); | ||
el.type= 'text/javascript'; | ||
el.src= src + '?' + now; | ||
el.onload = loadScript; | ||
// Load CSS | ||
} else { | ||
el= document.createElement('link'); | ||
el.rel = "stylesheet"; | ||
el.href = src + '?' + now; | ||
el.type = "text/css"; | ||
setTimeout(loadScript,0); | ||
} | ||
head.appendChild(el); | ||
// Load Scripts | ||
function loadScripts(){ | ||
scripts.forEach(function(src) { | ||
if(!src) return; | ||
// Ensure the 'src' has no '/' (it's in the root already) | ||
if(src[0] === '/') src = src.substr(1); | ||
src = manifest.root + src ; | ||
// Load javascript | ||
if(src.substr(-3) === ".js"){ | ||
el= document.createElement('script'); | ||
el.type= 'text/javascript'; | ||
el.src= src + '?' + now; | ||
el.async = false; | ||
// Load CSS | ||
} else { | ||
el= document.createElement('link'); | ||
el.rel = "stylesheet"; | ||
el.href = src + '?' + now; | ||
el.type = "text/css"; | ||
} | ||
head.appendChild(el); | ||
}); | ||
} | ||
@@ -95,5 +95,5 @@ | ||
if(manifest.root.substr(0,7) === 'cdvfile'){ | ||
document.addEventListener("deviceready", loadScript, false); | ||
document.addEventListener("deviceready", loadScripts, false); | ||
} else { | ||
loadScript(); | ||
loadScripts(); | ||
} | ||
@@ -100,0 +100,0 @@ // Save to global scope |
@@ -1,1 +0,1 @@ | ||
!function(){function t(t,e,o){function n(){var e=r.shift();e&&("/"===e[0]&&(e=e.substr(1)),e=t.root+e,".js"===e.substr(-3)?(s=document.createElement("script"),s.type="text/javascript",s.src=e+"?"+i,s.onload=n):(s=document.createElement("link"),s.rel="stylesheet",s.href=e+"?"+i,s.type="text/css",setTimeout(n,0)),a.appendChild(s))}if(!t.load)return void console.error("Manifest has nothing to load (manifest.load is empty).",t);var s,a=document.getElementsByTagName("head")[0],r=t.load.concat(),i=Date.now();t.root=t.root||"./",t.root.length>0&&"/"!==t.root[t.root.length-1]&&(t.root+="/"),e||localStorage.setItem("manifest",JSON.stringify(t)),"cdvfile"===t.root.substr(0,7)?document.addEventListener("deviceready",n,!1):n(),window.Manifest=t,e&&setTimeout(function(){window.BOOTSTRAP_OK||(console.warn("BOOTSTRAP_OK !== true; Resetting to original manifest.json..."),localStorage.removeItem("manifest"),location.reload())},o)}window.pegasus=function(t,e){return e=new XMLHttpRequest,e.open("GET",t),t=[],e.onreadystatechange=e.then=function(o,n,s){o.call&&(t=[o,n]),4==e.readyState&&(s=t[0|e.status/400],s&&s(200===e.status||0===e.status?JSON.parse(e.responseText):e))},e.send(),e},window.Manifest={};var e=JSON.parse(localStorage.getItem("manifest")),o=document.querySelector("script[manifest]");if(e)t(e,!0,o.getAttribute("timeout")||1e4);else{var n=(o?o.getAttribute("manifest"):null)||"manifest.json";pegasus(n).then(t,function(t){console.error("Could not download "+n+": "+t.status)})}}(); | ||
!function(){function t(t,e,o){function n(){r.forEach(function(e){e&&("/"===e[0]&&(e=e.substr(1)),e=t.root+e,".js"===e.substr(-3)?(s=document.createElement("script"),s.type="text/javascript",s.src=e+"?"+i,s.async=!1):(s=document.createElement("link"),s.rel="stylesheet",s.href=e+"?"+i,s.type="text/css"),a.appendChild(s))})}if(!t.load)return void console.error("Manifest has nothing to load (manifest.load is empty).",t);var s,a=document.getElementsByTagName("head")[0],r=t.load.concat(),i=Date.now();t.root=t.root||"./",t.root.length>0&&"/"!==t.root[t.root.length-1]&&(t.root+="/"),e||localStorage.setItem("manifest",JSON.stringify(t)),"cdvfile"===t.root.substr(0,7)?document.addEventListener("deviceready",n,!1):n(),window.Manifest=t,e&&setTimeout(function(){window.BOOTSTRAP_OK||(console.warn("BOOTSTRAP_OK !== true; Resetting to original manifest.json..."),localStorage.removeItem("manifest"),location.reload())},o)}window.pegasus=function(t,e){return e=new XMLHttpRequest,e.open("GET",t),t=[],e.onreadystatechange=e.then=function(o,n,s){o.call&&(t=[o,n]),4==e.readyState&&(s=t[0|e.status/400],s&&s(200===e.status||0===e.status?JSON.parse(e.responseText):e))},e.send(),e},window.Manifest={};var e=JSON.parse(localStorage.getItem("manifest")),o=document.querySelector("script[manifest]");if(e)t(e,!0,o.getAttribute("timeout")||1e4);else{var n=(o?o.getAttribute("manifest"):null)||"manifest.json";pegasus(n).then(t,function(t){console.error("Could not download "+n+": "+t.status)})}}(); |
{ | ||
"name": "cordova-app-loader", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Cordova App Loader - remote update your cordova app", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -383,2 +383,6 @@ cordova-app-loader | ||
### 0.10.0 (02/12/2014) | ||
* Improved loading time of scripts in bootstrap.js (parallel download instead of one-by-one). Thanks [lylepratt](https://github.com/lylepratt)! | ||
### 0.9.0 (02/12/2014) | ||
@@ -385,0 +389,0 @@ |
@@ -57,24 +57,24 @@ (function(){ | ||
// Load Next Script | ||
function loadScript(){ | ||
var src = scripts.shift(); | ||
if(!src) return; | ||
// Ensure the 'src' has no '/' (it's in the root already) | ||
if(src[0] === '/') src = src.substr(1); | ||
src = manifest.root + src ; | ||
// Load javascript | ||
if(src.substr(-3) === ".js"){ | ||
el= document.createElement('script'); | ||
el.type= 'text/javascript'; | ||
el.src= src + '?' + now; | ||
el.onload = loadScript; | ||
// Load CSS | ||
} else { | ||
el= document.createElement('link'); | ||
el.rel = "stylesheet"; | ||
el.href = src + '?' + now; | ||
el.type = "text/css"; | ||
setTimeout(loadScript,0); | ||
} | ||
head.appendChild(el); | ||
// Load Scripts | ||
function loadScripts(){ | ||
scripts.forEach(function(src) { | ||
if(!src) return; | ||
// Ensure the 'src' has no '/' (it's in the root already) | ||
if(src[0] === '/') src = src.substr(1); | ||
src = manifest.root + src ; | ||
// Load javascript | ||
if(src.substr(-3) === ".js"){ | ||
el= document.createElement('script'); | ||
el.type= 'text/javascript'; | ||
el.src= src + '?' + now; | ||
el.async = false; | ||
// Load CSS | ||
} else { | ||
el= document.createElement('link'); | ||
el.rel = "stylesheet"; | ||
el.href = src + '?' + now; | ||
el.type = "text/css"; | ||
} | ||
head.appendChild(el); | ||
}); | ||
} | ||
@@ -95,5 +95,5 @@ | ||
if(manifest.root.substr(0,7) === 'cdvfile'){ | ||
document.addEventListener("deviceready", loadScript, false); | ||
document.addEventListener("deviceready", loadScripts, false); | ||
} else { | ||
loadScript(); | ||
loadScripts(); | ||
} | ||
@@ -100,0 +100,0 @@ // Save to global scope |
1629175
452