How to use nprogress - 10 common examples

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 DefinitelyTyped / DefinitelyTyped / types / nprogress / nprogress-tests.ts View on Github external
import NProgress, { NProgressOptions } from 'nprogress';

console.log(NProgress.status);
console.log(NProgress.version);

// $ExpectType NProgress
NProgress.start();
NProgress.inc()
    .inc(0.2)
    .done();

NProgress.set(0.5);
NProgress.trickle();
console.log(NProgress.isStarted());
NProgress.done(true);

NProgress.configure({ minimum: 0.1 });
NProgress.configure({
    template: '<div></div>',
    easing: 'ease',
    speed: 500,
    trickle: true,
    showSpinner: false,
    trickleSpeed: 250,
    parent: '#content',
    // $ExpectError
    foo: ''
});
github DefinitelyTyped / DefinitelyTyped / types / nprogress / nprogress-tests.ts View on Github external
import NProgress, { NProgressOptions } from 'nprogress';

console.log(NProgress.status);
console.log(NProgress.version);

// $ExpectType NProgress
NProgress.start();
NProgress.inc()
    .inc(0.2)
    .done();

NProgress.set(0.5);
NProgress.trickle();
console.log(NProgress.isStarted());
NProgress.done(true);

NProgress.configure({ minimum: 0.1 });
NProgress.configure({
    template: '<div></div>',
github DefinitelyTyped / DefinitelyTyped / types / nprogress / nprogress-tests.ts View on Github external
import NProgress, { NProgressOptions } from 'nprogress';

console.log(NProgress.status);
console.log(NProgress.version);

// $ExpectType NProgress
NProgress.start();
NProgress.inc()
    .inc(0.2)
    .done();

NProgress.set(0.5);
NProgress.trickle();
console.log(NProgress.isStarted());
NProgress.done(true);

NProgress.configure({ minimum: 0.1 });
NProgress.configure({
    template: '<div></div>',
    easing: 'ease',
    speed: 500,
    trickle: true,
    showSpinner: false,
    trickleSpeed: 250,
    parent: '#content',
    // $ExpectError
    foo: ''
});
github DefinitelyTyped / DefinitelyTyped / types / nprogress / nprogress-tests.ts View on Github external
import NProgress, { NProgressOptions } from 'nprogress';

console.log(NProgress.status);
console.log(NProgress.version);

// $ExpectType NProgress
NProgress.start();
NProgress.inc()
    .inc(0.2)
    .done();

NProgress.set(0.5);
NProgress.trickle();
console.log(NProgress.isStarted());
NProgress.done(true);

NProgress.configure({ minimum: 0.1 });
NProgress.configure({
    template: '<div></div>',
    easing: 'ease',
github dotnetcore / WTM / demo / WalkingTec.Mvvm.VueDemo / ClientApp / src / router / permission.ts View on Github external
router.beforeEach(async (to: Route, _: Route, next: any) => {
  // 路由
  const loadI18n = (isFirst: Boolean = false) => {
    // 加载语言
    import(`@/pages${to.path}/local.ts`).then(LOCAL => {
        bindLang(LOCAL.default)
        isFirst ? next({ ...to, replace: true }) : next();
    }).catch(() => {
        console.warn('找不到 多语言文件');
        isFirst ? next({ ...to, replace: true }) : next();
    })
  }
  NProgress.start();
  if (UserModule.token) {
    // Check roles
    if (UserModule.roles.length === 0) {
      try {
        await UserModule.GetUserInfo();
        RoutesModule.PageList(pageList);
        RoutesModule.GenerateRoutes(UserModule.menus);
        router.addRoutes(RoutesModule.dynamicRoutes);
        loadI18n(UserModule.roles.length > 0);
      } catch (err) {
        Message.error(err || "Has Error");
        location.href = "/login.html";
        // next(`/login?redirect=${to.path}`);
        NProgress.done();
      }
    } else {
github wesbos / Advanced-React / finished-application / frontend / components / TakeMyMoney.js View on Github external
onToken = async (res, createOrder) => {
    NProgress.start();
    const order = await createOrder({
      variables: {
        token: res.id,
      },
    });
    console.log(order);
    // Route them to that order page
    const { id } = order.data.createOrder;
    Router.push({
      pathname: `/order`,
      query: { id },
    });
  };
  render() {
github yuboon / Aooms / aooms-rbac-webmgr / src / router / index.js View on Github external
router.beforeEach((to, from, next) => {
  // 进度条
  NProgress.start()
  // 关闭搜索面板
  store.commit('d2admin/search/set', false)
  // 验证当前路由所有的匹配中是否需要有登录验证的
  if (to.matched.some(r => r.meta.requiresAuth)) {
    // 这里暂时将cookie里是否存有token作为验证是否登录的条件
    // 请根据自身业务需要修改
    const token = util.cookies.get('AoomsToken')
    if (token && token !== 'undefined') {
      next()
    } else {
      // 将当前预计打开的页面完整地址临时存储 登录后继续跳转
      // 这个 cookie(redirect) 会在登录后自动删除
      //util.cookies.set('redirect', to.fullPath)
      // 没有登录的时候跳转到登录界面
      next({
        name: 'login'
github lacymorrow / cinematic / client / main.js View on Github external
Template.body.rendered = function () {
	/* Third-Party Progress bar: NProgress */
	NProgress.configure({trickleRate: 0.01, trickleSpeed: 1400})
	NProgress.start()

	// Jquery tooltip for reset button
	$('[data-toggle="tooltip"]').tooltip()

	// Receive files from Electron
	// Desktop.on('desktop', 'selected-file', (event, data) => {
	// 	console.log('Selected File Dialog Data:', event, data)
	// 	if (data.length === 1) {
	// 		// Single folder to open
	// 		$('#directory').val(data[0])
	// 		setPath()
	// 	}
	// })
}
github lskjs / ux / src / utils / Progress.js View on Github external
try {
    return NProgress._start(...args);
  } catch (err) {
    // console.log('err', err);
  }
};
NProgress._done = NProgress.done;
NProgress.done = (...args) => {
  try {
    return NProgress._done(...args);
  } catch (err) {
    // console.log('err', err);
  }
};

NProgress.Bar = ({ id }) => React.createElement('div', { id, className: 'nprogress' });
NProgress.parentClassName = 'nprogress-parent';

export default NProgress;
github lskjs / ux / src / utils / Progress.js View on Github external
NProgress.done = (...args) => {
  try {
    return NProgress._done(...args);
  } catch (err) {
    // console.log('err', err);
  }
};