X-Git-Url: https://git.mdrn.pl/wl-mobile.git/blobdiff_plain/2f315aa89bfdc0be1cb84ef27809be8886e55abe..e02aa48b6f2b7ddca9b55c56288cd2512702da6d:/assets/www/js/downloader.js?ds=sidebyside diff --git a/assets/www/js/downloader.js b/assets/www/js/downloader.js index f5b6f2b..15edf30 100644 --- a/assets/www/js/downloader.js +++ b/assets/www/js/downloader.js @@ -1,15 +1,19 @@ -function Downloader() { - -} - -Downloader.prototype.downloadFile = function(fileUrl,dirName,fileName,overwrite,win,fail) { - if(overwrite==false) overwrite="false"; - else overwrite="true"; - PhoneGap.exec(win, fail, "Downloader", "downloadFile", [fileUrl,dirName,fileName,overwrite]); - +/** + * + * @return Object literal singleton instance of Downloader + */ +var Downloader = { + /** + * @param fileUrl + * @param dirName + * @param fileName + * @param overwrite + * @param win + * @param fail + */ + downloadFile: function(fileUrl,dirName,fileName,overwrite,win,fail) { + if(overwrite==false) overwrite="false"; + else overwrite="true"; + return PhoneGap.exec(win, fail, "Downloader", "downloadFile", [fileUrl,dirName,fileName,overwrite]); + } }; - -PhoneGap.addConstructor(function() { - PhoneGap.addPlugin("downloader", new Downloader()); - PluginManager.addService("Downloader","pl.org.nowoczesnapolska.wlmobi.Downloader"); -}); \ No newline at end of file