There are load (success) and loadend (all outcomes) events that fire when
the whole file has been read. A quick check suggests they have full
cross-browser support.

Would they work?

Mark.
.


On Sat, 20 Jul 2019, 07:56 GitBox, <g...@apache.org> wrote:

> mike-jumper commented on a change in pull request #428: GUACAMOLE-827: If
> the FileReader object is busy, don't continue with …
> URL:
> https://github.com/apache/guacamole-client/pull/428#discussion_r305570419
>
>
>
>  ##########
>  File path: guacamole-common-js/src/main/webapp/modules/BlobWriter.js
>  ##########
>  @@ -120,6 +124,12 @@ Guacamole.BlobWriter = function BlobWriter(stream) {
>           */
>          var readNextChunk = function readNextChunk() {
>
> +            while (reader.readyState == 1) {
> +                // The reader is busy so give it time to finish before
> proceeding.
> +                // 1 second might be a bit generous, but it seems
> functional.
> +                await sleep(1000);
>
>  Review comment:
>    We cannot safely use `await` at this level of the API. Doing so would
> require dropping support for IE10+ and would require some significant
> discussion. I believe the same goes for `Promise` and the arrow notation.
>
>    That said, this may not matter: I don't believe we should use this
> approach. It may technically work, but there has to be a better way than
> polling `readyState` every second.
>
>    Are there no callbacks, events, etc. that can be used here such that we
> can rely on a call to `readNextChunk()` when the `FileReader` is actually
> ready?
>
> ----------------------------------------------------------------
> This is an automated message from the Apache Git Service.
> To respond to the message, please log on to GitHub and use the
> URL above to go to the specific comment.
>
> For queries about this service, please contact Infrastructure at:
> us...@infra.apache.org
>
>
> With regards,
> Apache Git Services
>

Reply via email to