| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,4 +3,9 @@ import {RouteSegment, Tree} from './segments'; | |||
| 3 | 3 | export interface OnActivate { | |
| 4 | 4 | routerOnActivate(curr: RouteSegment, prev?: RouteSegment, currTree?: Tree<RouteSegment>, | |
| 5 | 5 | prevTree?: Tree<RouteSegment>): void; | |
| 6 | + } | ||
| 7 | + | ||
| 8 | + export interface CanDeactivate { | ||
| 9 | + routerCanDeactivate(currTree?: Tree<RouteSegment>, | ||
| 10 | + futureTree?: Tree<RouteSegment>): Promise<boolean>; | ||
| 6 | 11 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | import './interfaces.dart'; | |
| 2 | 2 | bool hasLifecycleHook(String name, Object obj) { | |
| 3 | 3 | if (name == "routerOnActivate") return obj is OnActivate; | |
| 4 | + if (name == "routerCanDeactivate") return obj is CanDeactivate; | ||
| 4 | 5 | return false; | |
| 5 | 6 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | - import {Type} from 'angular2/src/facade/lang'; | ||
| 1 | + import {Type, isBlank} from 'angular2/src/facade/lang'; | ||
| 2 | 2 | ||
| 3 | 3 | export function hasLifecycleHook(name: string, obj: Object): boolean { | |
| 4 | + if (isBlank(obj)) return false; | ||
| 4 | 5 | let type = obj.constructor; | |
| 5 | 6 | if (!(type instanceof Type)) return false; | |
| 6 | 7 | return name in(<any>type).prototype; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - import {Type, isPresent} from 'angular2/src/facade/lang'; | ||
| 1 | + import {Type, isBlank} from 'angular2/src/facade/lang'; | ||
| 2 | 2 | import {RouteLifecycleHook, CanActivate} from './lifecycle_annotations_impl'; | |
| 3 | 3 | import {reflector} from 'angular2/src/core/reflection/reflection'; | |
| 4 | 4 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments