How to use the @aurelia/router.HookTypes.TransformFromUrl 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 / packages / __tests__ / router / hook-manager.spec.ts View on Github external
it('uses consequtive hooks', async function () {
    const { router, tearDown, navigationInstruction } = await createFixture();

    const sut = new HookManager();
    sut.addHook((url: string, navigationInstruction: INavigatorInstruction) => Promise.resolve(`hooked:${url}`),
      { type: HookTypes.TransformFromUrl });
    sut.addHook((url: string, navigationInstruction: INavigatorInstruction) => Promise.resolve(`hooked2:${url}`),
      { type: HookTypes.TransformFromUrl });

    const hooked = await sut.invokeTransformFromUrl('testing', navigationInstruction);
    assert.strictEqual(hooked, 'hooked2:hooked:testing', `hooked`);

    await tearDown();
  });
github aurelia / aurelia / packages / __tests__ / router / hook-manager.spec.ts View on Github external
it('uses a hook', async function () {
    const { router, tearDown, navigationInstruction } = await createFixture();

    const sut = new HookManager();
    sut.addHook((url: string, navigationInstruction: INavigatorInstruction): Promise => Promise.resolve(`hooked:${url}`),
      { type: HookTypes.TransformFromUrl });
    const hooked = await sut.invokeTransformFromUrl('testing', navigationInstruction);
    assert.strictEqual(hooked, 'hooked:testing', `hooked`);

    await tearDown();
  });