User Tools

Site Tools


built_in:downloader

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
built_in:downloader [2015/01/08 14:31]
thomaskwd
built_in:downloader [2015/03/29 11:56]
octazid [Table]
Line 2: Line 2:
  
 For downloading files (including zip files) //direct to sdcard//, you can use the app.CreateDownloader() method like this: For downloading files (including zip files) //direct to sdcard//, you can use the app.CreateDownloader() method like this:
 +<code>dload = app.CreateDownloader();</code>
  
 ===== Methods ===== ===== Methods =====
-^Method ^Description ^ +^ Method                                   ^ Description                                                                                                                                       
-|Downloader.Download(sourceURI,destPath) |Start download. You can pass a comma seperated list of file urls to download. destPath should be a valid and accessible folder on the device+| Downloader.Download(sourceURI,destPath)  | Start download. You can pass a comma seperated list of file urls to download. **destPath** should be a valid and accessible folder on the device  
-|Downloader.IsComplete() |returns true/false +| Downloader.GetProgress()                 | returns fract value 0..1, but "NaN" if not yet started                                                                                            
-|Downloader.GetProgress() | returns fract value 0..1, but "NaN" if not yet started| +| Downloader.GetSize()                                                                                                                                                                       | 
-|Downloader.GetSize() | | +| Downloader.IsComplete()                  | returns true/false                                                                                                                                
-|Downloader.SetOnComplete(callback) |Should be done before starting the download. |+| Downloader.SetOnComplete(callback)       | Should be done before starting the download.                                                                                                      |
  
-Example code snippet: +=====Example code snippet ===== 
-<code>+<code javascript>
 dload = app.CreateDownloader(); dload = app.CreateDownloader();
 dload.SetOnComplete( dload_OnComplete ); dload.SetOnComplete( dload_OnComplete );
 dload.Download( srcFileUrl, targetDir ); dload.Download( srcFileUrl, targetDir );
  
-function dload_OnComplete() {+function dload_OnComplete() 
 +{
     // we know download is ready now     // we know download is ready now
     // (but not if success or not)     // (but not if success or not)
built_in/downloader.txt · Last modified: 2018/04/19 23:14 (external edit)