// Configure localforage to display NeDB name for now. Would be a good idea to let user use his own app name
localforage.config({
name:'NeDB'
,storeName:'nedbdata'
});
functionexists(filename,callback){
// In this specific case this always answers that the file doesn't exist
if(typeoflocalStorage==='undefined'){console.log("WARNING - This browser doesn't support localStorage, no data will be saved in NeDB!");returncallback();}
if(localStorage.getItem(filename)!==null){
returncallback(true);
}else{
returncallback(false);
}
localforage.getItem(filename,function(err,value){
if(value!==null){// Even if value is undefined, localforage returns null
returncallback(true);
}else{
returncallback(false);
}
});
}
functionrename(filename,newFilename,callback){
if(typeoflocalStorage==='undefined'){console.log("WARNING - This browser doesn't support localStorage, no data will be saved in NeDB!");returncallback();}
if(typeoflocalStorage==='undefined'){console.log("WARNING - This browser doesn't support localStorage, no data will be saved in NeDB!");returncallback();}
if(typeoflocalStorage==='undefined'){console.log("WARNING - This browser doesn't support localStorage, no data will be saved in NeDB!");returncallback();}
if(typeoflocalStorage==='undefined'){console.log("WARNING - This browser doesn't support localStorage, no data will be saved in NeDB!");returncallback();}
if(typeoflocalStorage==='undefined'){console.log("WARNING - This browser doesn't support localStorage, no data will be saved in NeDB!");returncallback();}