Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** This file contains interfaces for Screen Activation Lifecycle hooks that Views can use. */
- declare module 'aurelia/lifecycle/view-hooks' {
- import {Router, RouterConfiguration, RouteConfig, NavigationInstruction} from "aurelia-router";
- /**
- * A Navigation Command is any object with a navigate(router: Router) method.
- * When a navigation command is encountered, the current navigation will be cancelled and
- * control will be passed to the navigation command so it can determine the correct action.
- */
- export type NavicationCommand = {
- navigate(appRouter: Router): void
- }
- /** contains property for each route parameter */
- export type RouteParams = Object;
- export type ActivationResult = boolean | Promise<boolean> | NavicationCommand;
- export interface ConfigureRouter {
- /**
- * Implement this hook if you want to add sub-routes to your view.
- */
- configureRouter(config: RouterConfiguration, router: Router);
- }
- export interface CanActivate {
- /**
- * Implement this hook if you want to control whether or not your view-model can be navigated to.
- * Return a boolean value, a promise for a boolean value, or a navigation command.
- */
- canActivate(params: RouteParams, routerConfig: RouteConfig, navigationInstruction: NavigationInstruction): ActivationResult;
- }
- export interface Activate {
- /**
- * Implement this hook if you want to perform custom logic just before your view-model is displayed.
- * You can optionally return a promise to tell the router to wait to bind and attach the view until after you finish your work.
- */
- activate(params: RouteParams, routerConfig: RouteConfig, navigationInstruction: NavigationInstruction): void | Promise<any>;
- }
- export interface CanDeactivate {
- /**
- * Implement this hook if you want to control whether or not the router can navigate away from your view-model when moving to a new route.
- * Return a boolean value, a promise for a boolean value, or a navigation command.
- */
- canDeactivate(): ActivationResult;
- }
- export interface Deactivate {
- /**
- * Implement this hook if you want to perform custom logic when your view-model is being navigated away from.
- * You can optionally return a promise to tell the router to wait until after you finish your work.
- */
- deactivate(): void | Promise<any>;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement