Javascript class for cordova app caching using file system api