@@ -933,130 +933,132 @@ export class Component extends Directive {
933933 * - `onCheck`,
934934 * - `onAllChangesDone`
935935 */
936- @CONST ( )
937- export class LifecycleEvent {
938- constructor ( public name : string ) { }
939- }
940-
941- /**
942- * Notify a directive whenever a {@link View} that contains it is destroyed.
943- *
944- * ## Example
945- *
946- * ```
947- * @Directive ({
948- * ...,
949- * lifecycle: [onDestroy]
950- * })
951- * class ClassSet {
952- * onDestroy() {
953- * // invoked to notify directive of the containing view destruction.
954- * }
955- * }
956- * ```
957- */
958- export const onDestroy : LifecycleEvent = CONST_EXPR ( new LifecycleEvent ( "onDestroy" ) ) ;
936+ export enum LifecycleEvent {
937+ /**
938+ * Notify a directive whenever a {@link View} that contains it is destroyed.
939+ *
940+ * ## Example
941+ *
942+ * ```
943+ * @Directive ({
944+ * ...,
945+ * lifecycle: [LifecycleEvent.onDestroy]
946+ * })
947+ * class ClassSet {
948+ * onDestroy() {
949+ * // invoked to notify directive of the containing view destruction.
950+ * }
951+ * }
952+ * ```
953+ * @exportedAs angular2/annotations
954+ */
955+ onDestroy ,
959956
960957
961- /**
962- * Notify a directive when any of its bindings have changed.
963- *
964- * This method is called right after the directive's bindings have been checked,
965- * and before any of its children's bindings have been checked.
966- *
967- * It is invoked only if at least one of the directive's bindings has changed.
968- *
969- * ## Example:
970- *
971- * ```
972- * @Directive ({
973- * selector: '[class-set]',
974- * properties: [
975- * 'propA',
976- * 'propB'
977- * ],
978- * lifecycle: [onChange]
979- * })
980- * class ClassSet {
981- * propA;
982- * propB;
983- * onChange(changes:{[idx: string, PropertyUpdate]}) {
984- * // This will get called after any of the properties have been updated.
985- * if (changes['propA']) {
986- * // if propA was updated
987- * }
988- * if (changes['propA']) {
989- * // if propB was updated
990- * }
991- * }
992- * }
993- * ```
994- */
995- export const onChange : LifecycleEvent = CONST_EXPR ( new LifecycleEvent ( "onChange" ) ) ;
958+ /**
959+ * Notify a directive when any of its bindings have changed.
960+ *
961+ * This method is called right after the directive's bindings have been checked,
962+ * and before any of its children's bindings have been checked.
963+ *
964+ * It is invoked only if at least one of the directive's bindings has changed.
965+ *
966+ * ## Example:
967+ *
968+ * ```
969+ * @Directive ({
970+ * selector: '[class-set]',
971+ * properties: [
972+ * 'propA',
973+ * 'propB'
974+ * ],
975+ * lifecycle: [LifecycleEvent.onChange]
976+ * })
977+ * class ClassSet {
978+ * propA;
979+ * propB;
980+ * onChange(changes:{[idx: string, PropertyUpdate]}) {
981+ * // This will get called after any of the properties have been updated.
982+ * if (changes['propA']) {
983+ * // if propA was updated
984+ * }
985+ * if (changes['propA']) {
986+ * // if propB was updated
987+ * }
988+ * }
989+ * }
990+ * ```
991+ * @exportedAs angular2/annotations
992+ */
993+ onChange ,
996994
997- /**
998- * Notify a directive when it has been checked.
999- *
1000- * This method is called right after the directive's bindings have been checked,
1001- * and before any of its children's bindings have been checked.
1002- *
1003- * It is invoked every time even when none of the directive's bindings has changed.
1004- *
1005- * ## Example:
1006- *
1007- * ```
1008- * @Directive ({
1009- * selector: '[class-set]',
1010- * lifecycle: [onCheck]
1011- * })
1012- * class ClassSet {
1013- * onCheck() {
1014- * }
1015- * }
1016- * ```
1017- */
1018- export const onCheck : LifecycleEvent = CONST_EXPR ( new LifecycleEvent ( "onCheck" ) ) ;
995+ /**
996+ * Notify a directive when it has been checked.
997+ *
998+ * This method is called right after the directive's bindings have been checked,
999+ * and before any of its children's bindings have been checked.
1000+ *
1001+ * It is invoked every time even when none of the directive's bindings has changed.
1002+ *
1003+ * ## Example:
1004+ *
1005+ * ```
1006+ * @Directive ({
1007+ * selector: '[class-set]',
1008+ * lifecycle: [LifecycleEvent.onCheck]
1009+ * })
1010+ * class ClassSet {
1011+ * onCheck() {
1012+ * }
1013+ * }
1014+ * ```
1015+ * @exportedAs angular2/annotations
1016+ */
1017+ onCheck ,
10191018
1020- /**
1021- * Notify a directive when it has been checked the first itme.
1022- *
1023- * This method is called right after the directive's bindings have been checked,
1024- * and before any of its children's bindings have been checked.
1025- *
1026- * It is invoked only once.
1027- *
1028- * ## Example:
1029- *
1030- * ```
1031- * @Directive ({
1032- * selector: '[class-set]',
1033- * lifecycle: [onInit]
1034- * })
1035- * class ClassSet {
1036- * onInit() {
1037- * }
1038- * }
1039- * ```
1040- */
1041- export const onInit : LifecycleEvent = CONST_EXPR ( new LifecycleEvent ( "onInit" ) ) ;
1019+ /**
1020+ * Notify a directive when it has been checked the first itme.
1021+ *
1022+ * This method is called right after the directive's bindings have been checked,
1023+ * and before any of its children's bindings have been checked.
1024+ *
1025+ * It is invoked only once.
1026+ *
1027+ * ## Example:
1028+ *
1029+ * ```
1030+ * @Directive ({
1031+ * selector: '[class-set]',
1032+ * lifecycle: [LifecycleEvent.onInit]
1033+ * })
1034+ * class ClassSet {
1035+ * onInit() {
1036+ * }
1037+ * }
1038+ * ```
1039+ * @exportedAs angular2/annotations
1040+ */
1041+ onInit ,
10421042
1043- /**
1044- * Notify a directive when the bindings of all its children have been checked (whether they have
1045- * changed or not).
1046- *
1047- * ## Example:
1048- *
1049- * ```
1050- * @Directive ({
1051- * selector: '[class-set]',
1052- * lifecycle: [onAllChangesDone]
1053- * })
1054- * class ClassSet {
1055- *
1056- * onAllChangesDone() {
1057- * }
1058- *
1059- * }
1060- * ```
1061- */
1062- export const onAllChangesDone : LifecycleEvent = CONST_EXPR ( new LifecycleEvent ( "onAllChangesDone" ) ) ;
1043+ /**
1044+ * Notify a directive when the bindings of all its children have been checked (whether they have
1045+ * changed or not).
1046+ *
1047+ * ## Example:
1048+ *
1049+ * ```
1050+ * @Directive ({
1051+ * selector: '[class-set]',
1052+ * lifecycle: [LifecycleEvent.onAllChangesDone]
1053+ * })
1054+ * class ClassSet {
1055+ *
1056+ * onAllChangesDone() {
1057+ * }
1058+ *
1059+ * }
1060+ * ```
1061+ * @exportedAs angular2/annotations
1062+ */
1063+ onAllChangesDone
1064+ }
0 commit comments