1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 2x 1x 2x 2x 2x | import {isFunction} from 'lodash'; function getPercent(loaded, total, computable){ if (!computable) return 100; return ((loaded / total) * 100); } export default function(progress){ Iif (!isFunction(progress)) return; return function(loaded, total, lengthComputable){ progress({ percent: getPercent(loaded, total, lengthComputable) , loaded: loaded , total: total }); }; }; |