Skip to content

Commit

Permalink
feat: add option skip first load
Browse files Browse the repository at this point in the history
  • Loading branch information
jambonn committed Mar 20, 2024
1 parent 428a6c7 commit 6c3218e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/progressbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const Progressbar = () => {
status: null,
settings: {
trickleSpeed: 800,
skipFirstLoad: false,
},
};
Progressbar.configure = (options) => {
Expand Down Expand Up @@ -184,10 +185,20 @@ export default {
VueProgressbar.configure(options);
global.$Progressbar = VueProgressbar;
if (config.router && typeof window !== 'undefined' && global.$router) {
let isSkipFirstLoad = global.$Progressbar.settings.skipFirstLoad;
global.$router.beforeEach(() => {
if (isSkipFirstLoad) {
return;
}

global.$Progressbar.start();
});
global.$router.afterEach(() => {
if (isSkipFirstLoad) {
isSkipFirstLoad = false;
return;
}

global.$Progressbar.done();
});
}
Expand Down

0 comments on commit 6c3218e

Please sign in to comment.