en:code:data:web
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:code:data:web [2011/10/01 22:32] – [Web] jmgr | en:code:data:web [2024/08/11 11:46] (current) – jmgr | ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| * onDownloadProgress - ([[# | * onDownloadProgress - ([[# | ||
| * onError - ([[# | * onError - ([[# | ||
| - | * file - (File or string) the file or filename to use as a destination for the downloaded data | + | * file - ([[en: |
| === Example === | === Example === | ||
| Line 32: | Line 32: | ||
| }); | }); | ||
| </ | </ | ||
| + | |||
| + | ===== Methods ===== | ||
| + | |||
| + | ==== download ==== | ||
| + | Start downloading. | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.download(url, | ||
| + | </ | ||
| + | <code javascript> | ||
| + | myObject.download(url); | ||
| + | </ | ||
| + | |||
| + | === Arguments === | ||
| + | - url - (string) the url of the resource to download | ||
| + | - options - (object) options | ||
| + | * rawHeaders - (object) raw headers to set | ||
| + | * method - (Method) the method to use (get or post) | ||
| + | * postData - (object) post data to send | ||
| + | * rawData - (string) raw post data to send [//Since version 3.11.0//] | ||
| + | * query - (object) query items | ||
| + | * user - (string) the username to use if asked | ||
| + | * password - (string) the password to use if asked | ||
| + | |||
| + | === Returns === | ||
| + | * (Web) this Web | ||
| + | |||
| + | === Exceptions === | ||
| + | * (OpenFileError) unable to open the destination file | ||
| + | |||
| + | === Notes === | ||
| + | This method is asynchronous, | ||
| + | To know when this is done use the [[# | ||
| + | |||
| + | ==== isDownloading ==== | ||
| + | Returns true if the data is still being downloaded. | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.isDownloading(); | ||
| + | </ | ||
| + | |||
| + | === Returns === | ||
| + | * (boolean) true if the data is still being downloaded | ||
| + | |||
| + | ==== toImage ==== | ||
| + | Returns the downloaded data as an [[en: | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.toImage(); | ||
| + | </ | ||
| + | |||
| + | === Returns === | ||
| + | * ([[en: | ||
| + | |||
| + | === Notes === | ||
| + | You cannot use this method if you specified a destination file as no data is kept in memory. | ||
| + | |||
| + | ==== toText ==== | ||
| + | Returns the downloaded data as text. | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.toText(encoding); | ||
| + | </ | ||
| + | <code javascript> | ||
| + | myObject.toText(); | ||
| + | </ | ||
| + | |||
| + | === Arguments === | ||
| + | - encoding - ([[en: | ||
| + | |||
| + | === Returns === | ||
| + | * (string) the text | ||
| + | |||
| + | === Notes === | ||
| + | You cannot use this method if you specified a destination file as no data is kept in memory. | ||
| + | |||
| + | ==== toRawData ==== | ||
| + | Returns the downloaded data as [[en: | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.toRawData(); | ||
| + | </ | ||
| + | |||
| + | === Returns === | ||
| + | * ([[en: | ||
| + | |||
| + | === Notes === | ||
| + | You cannot use this method if you specified a destination file as no data is kept in memory. | ||
| + | |||
| + | ==== cancel ==== | ||
| + | Cancel the download. | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.cancel(); | ||
| + | </ | ||
| + | |||
| + | === Returns === | ||
| + | * (Web) this Web | ||
| + | |||
| + | ===== Events ===== | ||
| + | |||
| + | ==== onFinished ==== | ||
| + | Called when the data has been downloaded. | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.onFinished = function() {}; | ||
| + | </ | ||
| + | |||
| + | === Example === | ||
| + | <code javascript> | ||
| + | myObject.onFinished = function() | ||
| + | { | ||
| + | //Event action | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | ==== onDownloadProgress ==== | ||
| + | Called when the download progression has changed. | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.onDownloadProgress = function(bytesReceived, | ||
| + | </ | ||
| + | |||
| + | === Arguments === | ||
| + | - bytesReceived - (integer) received byte count | ||
| + | - bytesTotal - (integer) total byte count | ||
| + | |||
| + | === Example === | ||
| + | <code javascript> | ||
| + | myObject.onDownloadProgress = function(bytesReceived, | ||
| + | { | ||
| + | //Event action | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | ==== onError ==== | ||
| + | Called when an error occurs. | ||
| + | |||
| + | === Syntax === | ||
| + | <code javascript> | ||
| + | myObject.onError = function(errorText) {}; | ||
| + | </ | ||
| + | |||
| + | === Arguments === | ||
| + | - errorText - (string) a text describing the error | ||
| + | |||
| + | === Example === | ||
| + | <code javascript> | ||
| + | myObject.onError = function(errorText) | ||
| + | { | ||
| + | //Event action | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | ===== Enumerations ===== | ||
| + | |||
| + | ==== Method ==== | ||
| + | The download method. | ||
| + | |||
| + | === Values === | ||
| + | - Get: use " | ||
| + | - Post: use " | ||
en/code/data/web.1317508350.txt.gz · Last modified: (external edit)
