How to use the @aurelia/router.RouterConfiguration.customize function in @aurelia/router

To help you get started, we’ve selected a few @aurelia/router 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 aurelia / aurelia / test / doc-example / app / src / startup.ts View on Github external
AuthorDetails,
      Authors,
      Book,
      BookDetails,
      Books,

      Chat,
      ChatUser,
      ChatUsers,

      Login,
      LoginSpecial,
      Main,

      JitHtmlBrowserConfiguration,
      RouterConfiguration.customize({ useHref: true }),
      DebugConfiguration,
    )
    .app({
      host: document.querySelector('app'),
      component: App,
    });

  await au.start().wait();
})().catch(console.error);
github aurelia / aurelia / packages / __tests__ / router / configuration.spec.ts View on Github external
it('can be activated with config object', async function () {
    this.timeout(5000);

    const { router, tearDown } = await createFixture({ separators: { viewport: '#' } });
    assert.strictEqual(router['isActive'], true, `router.isActive`);
    assert.strictEqual(router.instructionResolver.separators.viewport, '#', `router.instructionResolver.separators.viewport`);

    RouterConfiguration.customize();
    await tearDown();
  });
github aurelia / aurelia / packages / __tests__ / router / configuration.spec.ts View on Github external
async function createFixture(config?) {
    const ctx = TestContext.createHTMLTestContext();
    const { container, lifecycle } = ctx;

    const App = CustomElement.define({ name: 'app', template: '<template></template>' });
    const host = ctx.doc.createElement('div');
    ctx.doc.body.appendChild(host as any);

    const au = new Aurelia(container)
      .register(
        DebugConfiguration,
        !config ? RouterConfiguration : RouterConfiguration.customize(config),
        App)
      .app({ host: host, component: App });

    const router = getModifiedRouter(container);

    await au.start().wait();

    async function tearDown() {
      router.deactivate();
      await au.stop().wait();
      ctx.doc.body.removeChild(host);
    }

    return { au, container, lifecycle, host, router, ctx, tearDown };
  }
github aurelia / aurelia / packages / __tests__ / router / hook-manager.spec.ts View on Github external
if (hash &gt;= 0) {
      path = path.slice(0, hash);
    }
    wnd.history.replaceState({}, '', path);

    const host = doc.createElement('div');
    if (App === void 0) {
      dependencies = dependencies.map(dep =&gt; typeof dep === 'string'
        ? CustomElement.define({ name: dep, template: `!${dep}!` })
        : dep);
      App = CustomElement.define({ name: 'app', template: '', dependencies });
    }
    const au = new Aurelia(container)
      .register(
        DebugConfiguration,
        !config ? RouterConfiguration : RouterConfiguration.customize(config),
        App)
      .app({ host: host, component: App });

    const router = container.get(IRouter);
    const { _pushState, _replaceState } = spyNavigationStates(router, stateSpy);

    await au.start().wait();

    async function tearDown() {
      unspyNavigationStates(router, _pushState, _replaceState);
      router.deactivate();
      RouterConfiguration.customize();
      await au.stop().wait();
    }

    const navigationInstruction: INavigatorInstruction = { instruction: 'test', fullStateInstruction: 'full-test' };
github aurelia / aurelia / packages / __tests__ / router / router.spec.ts View on Github external
public entry: number = 0;
        public reentryBehavior: string = 'default';
        public enter(params) {
          this.param = +params[0];
          this.entry++;
          this.reentryBehavior = plughReentryBehavior;
        }
      });

    const host = ctx.doc.createElement('div');
    ctx.doc.body.appendChild(host as any);

    const au = ctx.wnd['au'] = new Aurelia(container)
      .register(
        DebugConfiguration,
        !config ? RouterConfiguration : RouterConfiguration.customize(config),
        App)
      .app({ host: host, component: App });

    const router = getModifiedRouter(container);

    container.register(Foo, Bar, Baz, Qux, Quux, Corge, Uier, Grault, Garply, Waldo, Plugh);

    await au.start().wait();

    async function tearDown() {
      router.deactivate();
      await au.stop().wait();
      ctx.doc.body.removeChild(host);
    }

    return { au, container, scheduler, host, router, ctx, tearDown };
github aurelia / aurelia / packages / __tests__ / router / hook-manager.spec.ts View on Github external
async function tearDown() {
      unspyNavigationStates(router, _pushState, _replaceState);
      router.deactivate();
      RouterConfiguration.customize();
      await au.stop().wait();
    }
github aurelia / aurelia / test / realworld / src / main.ts View on Github external
Auth,

  DateValueConverter,
  FormatHtmlValueConverter,
  KeysValueConverter,
  MarkdownHtmlValueConverter,

  SharedState,
  HttpClient,
] as any;

(global as any).au = new Aurelia()
  .register(
    BasicConfiguration,
    DebugConfiguration,
    RouterConfiguration.customize({ useUrlFragmentHash: false }),
    ...globalResources,
  )
  .app({
    component: App,
    host: document.querySelector('app')!,
  })
  .start();