nicer spinner animation, some cleaning
[wl-mobile.git] / assets / www / js / downloader.js
index f5b6f2b..15edf30 100644 (file)
@@ -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