oustWebCache
In memory Caching of Remote Urls in the form of BLOB objects using fetch API
INSTRUCTIONS:
- Install the package using: bower install oustWebCache at the terminal
- Attach the js file 'oust-web-cache.js' as a reference in your main html file.
- Add 'oustWebCache' as a dependancy in your angular app.
- Inject 'webCacheManager' as a dependancy anywhere in your controller, service, etc.
MODELS:
- File : Properties -
- fileName
- url
METHODS:
-
webCacheManager.queueDownload() Argument(s): File(object) Returns: key(string) - A unique key generated by webCacheManager for this file. This key is used to extract the downloaded file later.
-
webCacheManager.startAllDownloads() Arguments: Null
- Starts All Queued Downloads
-
webCacheManager.reset() Argument(s): NONE Return(s): Null
- Resets the download queue. Will remove all pending and completed downloads.
-
webCacheManager.getTemporaryUrl() Argument(s): key(string) - Supply the key returned by the 'queueDownload' method to get the temporary URL of the corresponding file. Returns: url (string) - Temporary URL of the file.
- Method to get the temporary url of the file
EVENTS:
- webCacheManager.on('ALL_DOWNLOADS_COMPLETE', callback) - Called when all the downloades in the queue have completed
- webCacheManager.on('DOWNLOADS_STARTED', callback) - Called when the download(s) are started in the background.