@trengo/axios-progress-bar
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -111,6 +111,8 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
function loadProgressBar(config) { | ||
function loadProgressBar() { | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var instance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _axios2.default; | ||
var requestsCounter = 0; | ||
config.delay = config.delay !== undefined ? config.delay : 200; | ||
@@ -138,3 +140,3 @@ var setupStartProgress = function setupStartProgress() { | ||
_nprogress2.default.done(); | ||
}, 200); | ||
}, config.delay); | ||
} | ||
@@ -148,3 +150,3 @@ return response; | ||
_nprogress2.default.done(); | ||
}, 200); | ||
}, config.delay); | ||
} | ||
@@ -151,0 +153,0 @@ return Promise.reject(error); |
{ | ||
"name": "@trengo/axios-progress-bar", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A fork. Slim progress bar (NProgress) for Web applications that use Axios library for HTTP requests.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -8,4 +8,5 @@ import 'nprogress/nprogress.css' | ||
export function loadProgressBar (config, instance = axios) { | ||
export function loadProgressBar (config = {}, instance = axios) { | ||
let requestsCounter = 0 | ||
config.delay = config.delay !== undefined ? config.delay : 200 | ||
@@ -29,3 +30,3 @@ const setupStartProgress = () => { | ||
if ((--requestsCounter) === 0) { | ||
setTimeout(() => {NProgress.done()}, 200); | ||
setTimeout(() => {NProgress.done()}, config.delay); | ||
} | ||
@@ -37,3 +38,3 @@ return response | ||
if ((--requestsCounter) === 0) { | ||
setTimeout(() => {NProgress.done()}, 200); | ||
setTimeout(() => {NProgress.done()}, config.delay); | ||
} | ||
@@ -40,0 +41,0 @@ return Promise.reject(error) |
37471
13
672