Skip to content

Commit

Permalink
feat(type declarations): Refine the type
Browse files Browse the repository at this point in the history
signature of the activationStrategy enumeration with additional
information

Added the ActivationStrategy interface to describe the shape of the
activationStrategy object that enumerates router activation strategies.
  • Loading branch information
aluanhaddad committed Aug 6, 2017
1 parent c45b91c commit 638aef4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/interfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,21 @@ interface ConfiguresRouter {
*/
configureRouter(config: RouterConfiguration, router: Router): Promise<void>|PromiseLike<void>|void;
}

/**
* An optional interface describing the available activation strategies.
*/
interface ActivationStrategy {
/**
* Reuse the existing the view model without invoking lifecycle hooks.
*/
noChange: 'no-change';
/**
* Reuse the existing the view model, invoke Router lifecycle hooks.
*/
invokeLifecycle: 'invoke-lifecycle';
/**
* Replace the existing view model, invoking Router lifecycle hooks.
*/
replace: 'replace';
}
2 changes: 1 addition & 1 deletion src/navigation-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {_resolveUrl} from './util';
/**
* The strategy to use when activating modules during navigation.
*/
export const activationStrategy = {
export const activationStrategy: ActivationStrategy = {
noChange: 'no-change',
invokeLifecycle: 'invoke-lifecycle',
replace: 'replace'
Expand Down

0 comments on commit 638aef4

Please sign in to comment.