mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
minor changes
This commit is contained in:
parent
baf55b5423
commit
b4c1d4c2c2
2 changed files with 27 additions and 9 deletions
|
|
@ -4,7 +4,8 @@ var fs = require('fs');
|
|||
* {name: true}
|
||||
*/
|
||||
var FileNames = {},
|
||||
NamesList_s = '';
|
||||
NamesList_s = '',
|
||||
FallBack_s = '';
|
||||
|
||||
/* function thet use for crossplatform
|
||||
* access to fs.watch or fs.watchFile function
|
||||
|
|
@ -16,13 +17,26 @@ var Manifest = '';
|
|||
|
||||
setWatachFunctions();
|
||||
|
||||
/* function add file or files to manifest */
|
||||
exports.addFiles = function(pFileNames_a){
|
||||
if(pFileNames_a instanceof Array)
|
||||
for(var i=0; i < pFileNames_a.length; i++)
|
||||
exports.watch(pFileNames_a[i]);
|
||||
else
|
||||
exports.watch(pFileNames_a);
|
||||
/* function add file or files to manifest
|
||||
* Examples:
|
||||
* exports.addFiles('jquery.js'),
|
||||
* exports.addFiles(['jquery.js', 'client.js']);
|
||||
* exports.addFiles([{'http://cdn.jquery/jq.js':'jquery.js'}, 'client.js']);
|
||||
*/
|
||||
exports.addFiles = function(pFileNames){
|
||||
/* if a couple files */
|
||||
if(pFileNames instanceof Array)
|
||||
for(var i=0; i < pFileNames.length; i++)
|
||||
/* if fallback setted up */
|
||||
if(typeof pFileNames[i] === 'object')
|
||||
for(var lName in pFileNames){
|
||||
FallBack_s = lName + ' ' + pFileNames[lName] + '\n';
|
||||
exports.watch(pFileNames[lName]);
|
||||
}
|
||||
|
||||
else exports.watch(pFileNames[i]);
|
||||
|
||||
else exports.watch(pFileNames);
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -94,6 +108,8 @@ function processManifest(){
|
|||
NamesList_s +
|
||||
'NETWORK:\n' +
|
||||
'*';
|
||||
'FALLBACK:' +
|
||||
FallBack_s;
|
||||
|
||||
fs.writeFile('cloudcmd.appcache', Manifest, function(){
|
||||
console.log('cloudcmd.appcache refreshed');
|
||||
|
|
|
|||
|
|
@ -166,7 +166,9 @@ CloudServer.init = (function(){
|
|||
var lAppCache = CloudServer.AppCache;
|
||||
if(lAppCache){
|
||||
lAppCache.addFiles(
|
||||
['./lib/client/jquery.js', './font/DroidSansMono.woff','./min/all.min.css']);
|
||||
[{'http://themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff' : './font/DroidSansMono.woff'},
|
||||
{'//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js' : './lib/client/jquery.js'},
|
||||
'./min/all.min.css']);
|
||||
lAppCache.createManifest();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue