refactor(Lifecycle hooks): move the hooks to their own module (lifecycle_hooks)
BREAKING CHANGE Lifecycle hooks now live in the `angular2/lifecycle_hooks` module. They previously lived in the `metadata` module.
This commit is contained in:
@ -2,7 +2,7 @@ library angular2.src.core.compiler.directive_lifecycle_reflector;
|
||||
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
|
||||
bool hasLifecycleHook(/*LifecycleHook*/ interface, type) {
|
||||
bool hasLifecycleHook(interface, type) {
|
||||
if (type is! Type) return false;
|
||||
|
||||
return reflector.interfaces(type).contains(interface);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {Type} from 'angular2/src/core/facade/lang';
|
||||
import * as Interfaces from './interfaces';
|
||||
|
||||
export function hasLifecycleHook(lcInterface: Interfaces.LifecycleHook, type): boolean {
|
||||
export function hasLifecycleHook(lcInterface, type): boolean {
|
||||
if (!(type instanceof Type)) return false;
|
||||
|
||||
var proto = (<any>type).prototype;
|
||||
|
@ -8,10 +8,7 @@ import {StringMap} from 'angular2/src/core/facade/collection';
|
||||
* - `AfterContentInit`,
|
||||
* - `AfterContentChecked`,
|
||||
* - `OnDestroy` (at the very end before destruction)
|
||||
*
|
||||
* // todo(vicb): describe Dart & TS vs JS
|
||||
*/
|
||||
export interface LifecycleHook {}
|
||||
|
||||
/**
|
||||
* Notify a directive when any of its bindings have changed.
|
||||
@ -41,7 +38,7 @@ export interface LifecycleHook {}
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class OnChanges implements LifecycleHook {
|
||||
export class OnChanges {
|
||||
onChanges(changes: StringMap<string, any>): void {}
|
||||
}
|
||||
|
||||
@ -63,7 +60,7 @@ export class OnChanges implements LifecycleHook {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class OnInit implements LifecycleHook {
|
||||
export class OnInit {
|
||||
onInit(): void {}
|
||||
}
|
||||
|
||||
@ -86,7 +83,7 @@ export class OnInit implements LifecycleHook {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class DoCheck implements LifecycleHook {
|
||||
export class DoCheck {
|
||||
doCheck(): void {}
|
||||
}
|
||||
|
||||
@ -104,7 +101,7 @@ export class DoCheck implements LifecycleHook {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class OnDestroy implements LifecycleHook {
|
||||
export class OnDestroy {
|
||||
onDestroy(): void {}
|
||||
}
|
||||
|
||||
@ -122,7 +119,7 @@ export class OnDestroy implements LifecycleHook {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class AfterContentInit implements LifecycleHook {
|
||||
export class AfterContentInit {
|
||||
afterContentInit(): void {}
|
||||
}
|
||||
|
||||
@ -140,7 +137,7 @@ export class AfterContentInit implements LifecycleHook {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class AfterContentChecked implements LifecycleHook {
|
||||
export class AfterContentChecked {
|
||||
afterContentChecked(): void {}
|
||||
}
|
||||
|
||||
@ -158,7 +155,7 @@ export class AfterContentChecked implements LifecycleHook {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class AfterViewInit implements LifecycleHook {
|
||||
export class AfterViewInit {
|
||||
afterViewInit(): void {}
|
||||
}
|
||||
|
||||
@ -176,6 +173,6 @@ export class AfterViewInit implements LifecycleHook {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export class AfterViewChecked implements LifecycleHook {
|
||||
export class AfterViewChecked {
|
||||
afterViewChecked(): void {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user