[ 
https://issues.apache.org/jira/browse/CB-622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422578#comment-13422578
 ] 

Andrew Grieve commented on CB-622:
----------------------------------

Had a look at the JS part of your change and added some comments on github. 
Mostly just minor things though, good work!

I don't think we should worry about addEventListener, or else we would need to 
worry about implementing all of the features that go along with it. When we 
look at doing an XHR2 polyfill, then let's tackle that.

I think the -1 statusCode might get us into trouble down the road since 
statusCode isn't really an enum type. How about looking for the presence of a 
progress payload on the event callback to identify it? e.g., assuming your 
callback JSON looks like:
{lengthComputable:true, total:0, loaded:0}

Then you could do:
if ('lengthComputable' in e) {
  if (self.onprogress) {
    self.onprogress(e)
  }
}

If that's too wishwashy for you, adding an explicit "type" field to the 
callback JSON would work as well.

Passing the callback into the FileUploadOptions would allow the native side to 
not fire progress events when there is no progress callback. However, it would 
move the API further from XHR, and I think if progress events are causing 
performance problems, then they should be throttled on the native side either 
way. So, +1 to how you have it now, with an onprogress property.





                
> FileTransfer interface should provide progress monitoring
> ---------------------------------------------------------
>
>                 Key: CB-622
>                 URL: https://issues.apache.org/jira/browse/CB-622
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android, BlackBerry, iOS, WP7
>    Affects Versions: 1.7.0
>         Environment: Checked docs for iOS and Android, and in general.
>            Reporter: Brion Vibber
>            Priority: Minor
>              Labels: FileTransfer, file
>
> The FileTransfer upload and download interface seems to provide no way to 
> monitor progress of the upload/download, other than waiting for the entire 
> transfer to complete or fail.
> Being able to pass another callback for progress monitoring could be a useful 
> interface, this might get called with a byte count or something.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to