GithubHelp home page GithubHelp logo

jlvhangzhou / phonegap-plugin-wizassets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wizcorp/phonegap-plugin-wizassets

0.0 1.0 0.0 86 KB

PhoneGap plugin for managing application assets with javascript asset maps. Includes( background threaded) downloadFile, getFileURI, getFileURIs, deleteFile.

License: MIT License

phonegap-plugin-wizassets's Introduction

PLUGIN:

phonegap-plugin-wizAssets
version : 1.7
last update : 10/05/2012

CHANGELOG:


- Updated for Cordova 1.7

KNOWN ISSUES:


n/a

DESCRIPTION :

PhoneGap plugin for managing application assets with javascript asset maps. Includes( iOS background threaded) downloadFile, getFileURI, getFileURIs, deleteFile.

INSTALL (iOS):

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.

INSTALL (Android):

coming soon...




EXAMPLE CODE



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" 

} 

phonegap-plugin-wizassets's People

Contributors

aogilvie avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.