refactor(LifecycleEvent): remove LifecycleEvent

fixes #3924

BREAKING CHANGE

The `lifecycle` configuration for directive has been dropped.

Before

    // Dart
    @Component({lifecycle: const [LifecycleEvent.OnChanges], ...})
    class MyComponent implements OnChanges {
      void onChanges() {...}
    }

    // Typescript
    @Component({lifecycle: [LifecycleEvent.OnChanges], ...})
    class MyComponent implements OnChanges {
      onChanges(): void {...}
    }

    // ES5
    var MyComponent = ng.
    Component({lifecycle: [LifecycleEvent.OnChanges], ...}).
    Class({
      onChanges: function() {...}
    });

After

    // Dart
    @Component({...})
    class MyComponent implements OnChanges {
      void onChanges() {...}
    }

    // Typescript
    @Component({...})
    class MyComponent implements OnChanges {
      onChanges(): void {...}
    }

    // ES5
    var MyComponent = ng
      .Component({...})
      .Class({
        onChanges: function() {
        }
      });
This commit is contained in:
Victor Berchet
2015-08-31 18:32:32 -07:00
parent 67b9414268
commit 8302afffb4
42 changed files with 311 additions and 842 deletions

View File

@ -13,7 +13,6 @@ export {
ComponentMetadata,
DirectiveMetadata,
PipeMetadata,
LifecycleEvent,
PropertyMetadata,
EventMetadata,
HostBindingMetadata,
@ -33,7 +32,6 @@ import {
ComponentMetadata,
DirectiveMetadata,
PipeMetadata,
LifecycleEvent,
PropertyMetadata,
EventMetadata,
HostBindingMetadata,
@ -142,13 +140,11 @@ export interface ViewDecorator extends TypeDecorator {
export interface DirectiveFactory {
(obj: {
selector?: string, properties?: string[], events?: string[], host?: StringMap<string, string>,
lifecycle?: LifecycleEvent[], bindings?: any[], exportAs?: string,
compileChildren?: boolean;
bindings?: any[], exportAs?: string, compileChildren?: boolean;
}): DirectiveDecorator;
new (obj: {
selector?: string, properties?: string[], events?: string[], host?: StringMap<string, string>,
lifecycle?: LifecycleEvent[], bindings?: any[], exportAs?: string,
compileChildren?: boolean;
bindings?: any[], exportAs?: string, compileChildren?: boolean;
}): DirectiveMetadata;
}
@ -201,7 +197,6 @@ export interface ComponentFactory {
properties?: string[],
events?: string[],
host?: StringMap<string, string>,
lifecycle?: LifecycleEvent[],
bindings?: any[],
exportAs?: string,
compileChildren?: boolean,
@ -213,7 +208,6 @@ export interface ComponentFactory {
properties?: string[],
events?: string[],
host?: StringMap<string, string>,
lifecycle?: LifecycleEvent[],
bindings?: any[],
exportAs?: string,
compileChildren?: boolean,
@ -545,4 +539,4 @@ export var HostBinding: HostBindingFactory = makePropDecorator(HostBindingMetada
/**
* {@link HostListenerMetadata} factory function.
*/
export var HostListener: HostListenerFactory = makePropDecorator(HostListenerMetadata);
export var HostListener: HostListenerFactory = makePropDecorator(HostListenerMetadata);