X-Git-Url: https://git.mdrn.pl/wl-mobile.git/blobdiff_plain/2f315aa89bfdc0be1cb84ef27809be8886e55abe..91d4143f8e07f469843b2265ce3120bbd64e1fde:/assets/www/js/assetcopy.js diff --git a/assets/www/js/assetcopy.js b/assets/www/js/assetcopy.js index e7e0ac5..a9bc86f 100644 --- a/assets/www/js/assetcopy.js +++ b/assets/www/js/assetcopy.js @@ -1,14 +1,23 @@ -function AssetCopy() { - -} - -AssetCopy.prototype.copy = function(asset, target, overwrite, win, fail) { - if(overwrite==false) overwrite="false"; - else overwrite="true"; - PhoneGap.exec(win, fail, "AssetCopy", "copy", [asset, target, overwrite]); +/* + * This file is part of WolneLektury-Mobile, licensed under GNU Affero GPLv3 or later. + * Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. + */ + +/** + * + * @return Object literal singleton instance of AssetCopy + */ +var AssetCopy = { + /** + * @param asset Path to the asset (relative to assets dir) + * @param target Path to DB file (relative to app db files dir) + * @param overwrite + * @param win Success callback + * @param fail Error callback + */ + copy: function(asset, target, overwrite, win, fail) { + if(overwrite==false) overwrite="false"; + else overwrite="true"; + PhoneGap.exec(win, fail, "AssetCopy", "copy", [asset, target, overwrite]); + }, }; - -PhoneGap.addConstructor(function() { - PhoneGap.addPlugin("assetcopy", new AssetCopy()); - PluginManager.addService("AssetCopy","pl.org.nowoczesnapolska.wlmobi.AssetCopy"); -}); \ No newline at end of file