If you use a ManagedResourceStore, you can provide a manifest file which describe all the resources needed by your application.
On 1 juil, 21:31, tBeck <[email protected]> wrote: > Hello All, > > While using the LocalServer API with Gears the other day; I noticed > you had to manually define what files a page depends on such as the > JavaScript and CSS sources. Wouldn't it be better to provide a method > within the ResourceStore class of the LocalServer API to provide a way > to catch all the files that the page needs? I've created my own > version of this below: > > function findPageResources(self){ > > var resources = []; // resources found on the current page. > var docJavaScriptCSS = (document.getElementsByTagName("head")[0]); > var bodyJavaScriptCSS = (document.getElementsByTagName("body")[0]); > var locationSrc = [(docJavaScriptCSS.getElementsByTagName("script")), > (docJavaScriptCSS.getElementsByTagName("style")), > (bodyJavaScriptCSS.getElementsByTagName("script")), > (bodyJavaScriptCSS.getElementsByTagName("style"))]; > > for(var i=0;i<(locationSrc.length);i++){ > for(var d=0;d<(locationSrc[i].length);d++){ > var curColItem = (locationSrc[i][d]); > if(curColItem.src != null) resources.push(curColItem.src); > };}; return(resources); > > }; // end of findPageResources(...); > > Note: I'm not 100% familiar with Gears API yet and not sure if this > was already suggested or added and I just don't know about it. > > Thank You, > Developer > Tyler Beck
