11import { StringMap } from 'angular2/src/core/facade/collection' ;
22
3+ export enum LifecycleHooks {
4+ OnInit ,
5+ OnDestroy ,
6+ DoCheck ,
7+ OnChanges ,
8+ AfterContentInit ,
9+ AfterContentChecked ,
10+ AfterViewInit ,
11+ AfterViewChecked
12+ }
13+
314/**
415 * Lifecycle hooks are guaranteed to be called in the following order:
516 * - `OnChanges` (if any bindings have changed),
@@ -38,9 +49,7 @@ import {StringMap} from 'angular2/src/core/facade/collection';
3849 * }
3950 * ```
4051 */
41- export class OnChanges {
42- onChanges ( changes : StringMap < string , any > ) : void { }
43- }
52+ export interface OnChanges { onChanges ( changes : StringMap < string , any > ) ; }
4453
4554/**
4655 * Notify a directive when it has been checked the first time.
@@ -54,15 +63,13 @@ export class OnChanges {
5463 *
5564 * ```
5665 * @Component (...)
57- * class MyComponent @ implements OnInit {
66+ * class MyComponent implements OnInit {
5867 * onInit(): void {
5968 * }
6069 * }
6170 * ```
6271 */
63- export class OnInit {
64- onInit ( ) : void { }
65- }
72+ export interface OnInit { onInit ( ) ; }
6673
6774/**
6875 * Overrides the default change detection.
@@ -83,9 +90,7 @@ export class OnInit {
8390 * }
8491 * ```
8592 */
86- export class DoCheck {
87- doCheck ( ) : void { }
88- }
93+ export interface DoCheck { doCheck ( ) ; }
8994
9095/**
9196 * Notify a directive whenever a {@link ViewMetadata} that contains it is destroyed.
@@ -101,9 +106,7 @@ export class DoCheck {
101106 * }
102107 * ```
103108 */
104- export class OnDestroy {
105- onDestroy ( ) : void { }
106- }
109+ export interface OnDestroy { onDestroy ( ) ; }
107110
108111/**
109112 * Notify a directive when the bindings of all its content children have been checked the first
@@ -119,9 +122,7 @@ export class OnDestroy {
119122 * }
120123 * ```
121124 */
122- export class AfterContentInit {
123- afterContentInit ( ) : void { }
124- }
125+ export interface AfterContentInit { afterContentInit ( ) ; }
125126
126127/**
127128 * Notify a directive when the bindings of all its content children have been checked (whether
@@ -137,9 +138,7 @@ export class AfterContentInit {
137138 * }
138139 * ```
139140 */
140- export class AfterContentChecked {
141- afterContentChecked ( ) : void { }
142- }
141+ export interface AfterContentChecked { afterContentChecked ( ) ; }
143142
144143/**
145144 * Notify a directive when the bindings of all its view children have been checked the first time
@@ -155,9 +154,7 @@ export class AfterContentChecked {
155154 * }
156155 * ```
157156 */
158- export class AfterViewInit {
159- afterViewInit ( ) : void { }
160- }
157+ export interface AfterViewInit { afterViewInit ( ) ; }
161158
162159/**
163160 * Notify a directive when the bindings of all its view children have been checked (whether they
@@ -173,6 +170,4 @@ export class AfterViewInit {
173170 * }
174171 * ```
175172 */
176- export class AfterViewChecked {
177- afterViewChecked ( ) : void { }
178- }
173+ export interface AfterViewChecked { afterViewChecked ( ) ; }
0 commit comments