Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document smart ways for monitoring file upload progress in promise like fashion #361

Open
evilaliv3 opened this issue Feb 3, 2022 · 3 comments

Comments

@evilaliv3
Copy link
Member

I'm trying to implement monitoring of file upload completion in a promise like fashion and i consider that we miss proper documentaton for a functional and an efficient way to implement this.

This would be helpful for projects where the file upload is implemented within a form, where file uploads are set to start in pause state and the submit button is mapped to a trigger of file upload start that should then wait for file upload completion before performing submission completion.

The documentation should consider to clarify possibilities for efficiently waiting on a single flow object and on multiple flow objects.

@evilaliv3
Copy link
Member Author

@AidasK: Do you have by any chance any advice to implement this?

At the moment i'm evaluating that this could be only implemented by implementing a custom watch function with calls to the .progress() funcion to ensure the flow object / the multiple flow objects are in complete state.

Thank you for your support.

@evilaliv3
Copy link
Member Author

Here the current way i managed to check for this:

    $scope.interval = $interval(function() {
      for (key in $scope.uploads) {
        if ($scope.uploads[key] &&
            $scope.uploads[key].isUploading &&
            $scope.uploads[key].isUploading()) {
          return;
        }
      }

      $interval.cancel($scope.interval);

      // code to be executed when all the uploads have been completed

    }, 1000);

@AidasK
Copy link
Member

AidasK commented Feb 8, 2022

Since we are using promises, we should use them instead of the intervals. Can't we check if promise has resolved and check isUploading variable there? Using intervals or timeouts just shows that library is not flexible enough or it's used incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants