Syncano / syncano-js

Javascript SDK to interact with Syncano API. Full SDK Docs ->
http://syncano.github.io/syncano-js/
22 stars 3 forks source link

[LIB-903] Ability to listen to progress event #295

Closed jakubbilko closed 8 years ago

jakubbilko commented 8 years ago

You can now attach a callback fired on every progress event dispatched from the requests:

const connection = Syncano({ apiKey });

connection.onProgress((data) => {
  console.log(data);
  // { direction: 'upload',
  // lengthComputable: true,
  // loaded: 124,
  // total: 3777 }
});

To remove the callback, just set it to null: connection.onProgress(null);.

The event is fired only when using form-data requests (containing files).