Added static classes to log progress and errors
This commit is contained in:
parent
43c3e43984
commit
24ff7899c3
|
@ -22,4 +22,20 @@ export default class Helpers {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
static logProgress() {
|
||||
return function(xhr) {
|
||||
if(xhr.lengthComputable) {
|
||||
const percentComplete = xhr.loaded / xhr.total * 100;
|
||||
|
||||
console.log(Math.round(percentComplete, 2) + '% downloaded');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static logError() {
|
||||
return function(xhr) {
|
||||
console.error(xhr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue