How to use the @aurelia/router.ReentryBehavior.refresh 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 / realworld / src / components / profile / profile.ts View on Github external
import { inject } from '@aurelia/kernel';
import { IRouter, lifecycleLogger, ReentryBehavior } from '@aurelia/router';
import { Profile as ProfileModel } from 'shared/models/profile';
import { ProfileService } from 'shared/services/profile-service';
import { SharedState } from 'shared/state/shared-state';

@inject(SharedState, ProfileService, IRouter)
// @lifecycleLogger('profile')
export class Profile {
  public static parameters: string[] = ['name'];
  public reentryBehavior: string = ReentryBehavior.refresh;

  private username?: string;
  private profile?: ProfileModel;

  public constructor(
    private readonly sharedState: SharedState,
    private readonly profileService: ProfileService,
    private readonly router: IRouter) {
  }

  public canEnter() { console.log(`profile canEnter`); return true; }
  public created() { console.log(`profile created`); }
  public binding() { console.log(`profile binding`); }
  public bound() { console.log(`profile bound`); }
  public attaching() { console.log(`profile attaching`); }
  public attached() { console.log(`profile attached`); }