flowjs / flow.js

A JavaScript library providing multiple simultaneous, stable, fault-tolerant and resumable/restartable file uploads via the HTML5 File API.
Other
2.97k stars 347 forks source link

Added xhr readystatechange handler to options #253

Closed ludeus closed 4 years ago

ludeus commented 6 years ago

I need to add a listener on xhr, a quick fix would be to add an option

AidasK commented 6 years ago

I think this handler is missing some params, like which chunk or file has fired it?

AidasK commented 6 years ago

Please make it camelCase and add it to the docs

ludeus commented 6 years ago

I added the xhr option, inspired by the jquery ajax xhr option (http://api.jquery.com/jquery.ajax/). An additional parameter gives the file object

drzraf commented 4 years ago

This can be already be worked around by hijacking uploadMethod:

uploadMethod = (uploadMethod, fileObj, chunk) => { chunk.xhr.onreadystatechange = () => 'foo'; return 'POST'; }
AidasK commented 4 years ago

uploadMethod looks like a workaround, so I think this could be merged

ludeus commented 4 years ago

uploadMethod is a good solution