How to use the nprogress.set function in nprogress

To help you get started, we’ve selected a few nprogress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ecmadao / hacknical / frontend / api / base.js View on Github external
const fetchApi = (url, method, data) => {
  url = `/api${url}`
  NProgress.start()
  NProgress.set(0.4)
  const options = {
    method,
    credentials: 'same-origin',
    headers: {
      Accept: 'application/json,text/plain,*/*'
    }
  }
  if (rnoContent.test(method)) {
    const query = param(data)
    if (query) {
      url = url + (/\?$/.test(url) ? '' : '?') + query
    }
  } else if (data) {
    options.body = JSON.stringify(data)
    options.headers = {
      'Content-Type': 'application/json',
github MrHuxu / easy-interview / client / javascripts / modules / Question / actions / QuestionActions.js View on Github external
export function requestQuestions (args) {
  console.log('fetchOptions: ', args);
  NProgress.set(0.4);
  return function (dispatch) {
    return $.ajax({
      type: 'POST',
      url: '/question/get',
      data: JSON.stringify(args),
      contentType: 'application/json',
      dataType: 'JSON'
    }).done((data, textStatus, jqXHR) => {
      NProgress.set(0.8);
      dispatch(receiveQuestions(data));
    });
  };
};
github zhw2590582 / SubPlayer / src / utils / translate.js View on Github external
limit(async () => {
                    const data = await translator(item.text, land);
                    NProgress.set(++index / subtitles.length);
                    if (data) {
                        item.text = data;
                    }
                    return item;
                }),
            ),
github ecmadao / Learn-Koa2 / app / frontend / javascripts / utils / util.js View on Github external
export const handleAsyncFunc = async (asyncFunc, ...args) => {
  let result;
  try {
    NProgress.start();
    NProgress.set(0.4);
    result = await asyncFunc(...args);
  } catch (err) {
    result = null;
  } finally {
    NProgress.done();
    return result;
  }
};
github lincenying / mmf-blog-vue2-ssr / src / admin.vue View on Github external
'global.progress'(val) {
            if (val === 0) {
                NProgress.set(0)
                NProgress.start()
            } else if (val === 100) {
                NProgress.done()
            } else {
                NProgress.set(val / 100)
                NProgress.start()
            }
        }
    },
github TryStarboard / Starboard / source / client / actions-server / creators.js View on Github external
export function updateProgress(progress) {
  if (0 < progress && progress < 1) {
    if (!progressBarStarted) {
      progressBarStarted = true;
      NProgress.start();
    }
    NProgress.set(progress);
  } else {
    progressBarStarted = false;
    NProgress.done();
  }

  return {
    type: UPDATE_PROGRESS,
    payload: {progress},
  };
}
github MillerRen / vue-boilerplate / src / api / index.js View on Github external
Vue.http.options.progress = function (event) {
  if (event.lengthComputable) {
    NProgress.set(event.loaded / event.total)
  }
}
github zhw2590582 / SubPlayer / src / utils / wavesurfer.js View on Github external
ws.on('loading', integer => {
            if (!isBlobUrl) {
                NProgress.set(integer / 100);
            }
        });
    });
github YvesCoding / rcpress / packages / @rcpress / theme-default / Layout.tsx View on Github external
function handeLocationChange({ pathname }: any) {
      if (pathname == path) {
        tryScrollToHash();
        return;
      }

      NProgress.start();
      NProgress.set(0.6);
    }
github IBM / nicedoc.io / pages / readme.jsx View on Github external
const progressObserver = new ScrollProgress((x, y) => {
    y >= 0.999 ? NProgress.set(0.999) : NProgress.set(y)
  })