phonegap-plugin-wizAssets
version : 1.7
last update : 10/05/2012
- Updated for Cordova 1.7
n/a
PhoneGap plugin for managing application assets with javascript asset maps. Includes( iOS background threaded) downloadFile, getFileURI, getFileURIs, deleteFile.
Project tree
project
/ www
-index.html
/ assets [store your app assets here]
/ phonegap
/ plugin
/ wizAssets
/ wizAssets.js
/ Classes
/ Plugins
/ WizAssetsPlugin
/ WizAssetsPlugin.h
/ WizAssetsPlugin.m
-project.xcodeproj
1 ) Arrange files to structure seen above.
2 ) Add to cordova.plist in the plugins array;
Key : WizAssetsPlugin
Type : String
Value : WizAssetsPlugin
3 ) Add <script> tag to your index.html
<script type="text/javascript" charset="utf-8" src="phonegap/plugin/wizAssets/wizAssets.js"></script>
(assuming your index.html is setup like tree above)
4 ) Follow example code below.
coming soon...
Get all existing assets in the binary and other external folders (if existing)
wizAssets.downloadFile(String URL, String filePathToBeStoredWithFilename, Function success, Function fail);
* downloads a file to native App directory @ ./ + gameDir+ / +filePathToBeStoredWithFilename
* A success returns URI string like; file://documents/settings/img/cards/card001.jpg
* example;
{
wizAssets.downloadFile("http://google.com/logo.jpg" , "img/ui/logo.jpg", function(e){ alert("success "+e) } , function(e){ alert("fail "+e) } );
}
wizAssets.deleteFiles(Array manyURIs , Function success, Function fail );
* delete all URIs in Array like; [ "file://documents/settings/img/cards/card001.jpg" , "file://documents/settings/img/cards/card002.jpg " .. ]
* if you do specify a filename only dir, then all contents of dir will be deleted; file://documents/settings/img/cards
* the array CAN contain one URI string
wizAssets.getFileURI(String filePathWithFilename, Function success, Function fail);
* A success returns URI string like file://documents/settings/img/cards/card001.jpg
* example;
{
wizAssets.getFileURI("img/ui/logo.jpg" , function(e){ alert("success "+e) } , function(e){ alert("fail "+e) } );
}
wizAssets.getFileURIs(Function success, Function fail);
* A success returns URI hashmap such as
{
img/ui/loader.gif : "/sdcard//img/ui/loading.gif",
img/cards/card001.jpg : "file://documents/settings/img/cards/card001.jpg"
}