Added static classes to log progress and errors

This commit is contained in:
Paul Graffam 2016-10-07 04:38:54 -04:00
parent 43c3e43984
commit 24ff7899c3
1 changed files with 16 additions and 0 deletions

View File

@ -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);
}
}
} }