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

indicating progressbar #53

Closed
cahyowhy opened this issue Jul 11, 2017 · 1 comment
Closed

indicating progressbar #53

cahyowhy opened this issue Jul 11, 2017 · 1 comment

Comments

@cahyowhy
Copy link

how to provide a progress when post or get wit this library?
i tried this but doesnt work?

service(type = this.method.get, url = '', authorization = null, body = null) {
    const context = this;
    return new Ember.RSVP.Promise(
      function (resolve, reject) {
        fetch(url, {
          method: type,
          headers: {
            'Content-Type': 'application/json',
            "Authorization": authorization
          },
          body: body,
          xhrFields: {
            onprogress: function (e) {
              context.debug(e);
            }
          }
        }).progress(function (progress) {
          context.debug(progress);
        }).then(function (response) {
          resolve(response);
        }).catch(function (error) {
          reject(error);
        })
      });
  },
@tchak
Copy link
Collaborator

tchak commented Jul 12, 2017

fetch have no support for progress events. The solution is to use streams. But the streams are not supported in polyfill. This is how it is supposed to work https://jakearchibald.com/2015/thats-so-fetch/#streams

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

3 participants