refactor(transformers): extract lifecycle hooks from the interfaces

This commit is contained in:
Tim Blasi
2015-09-02 10:06:10 -07:00
committed by Victor Berchet
parent 8302afffb4
commit ef88e0f804
7 changed files with 160 additions and 102 deletions

View File

@ -11,8 +11,9 @@ void initReflector(reflector) {
reflector
..registerType(
HelloCmp,
new ReflectionInfo(
const [const Component(changeDetection: ChangeDetectionStrategy.CheckOnce)],
const [const []],
() => new HelloCmp()));
new ReflectionInfo(const [
const Component(changeDetection: ChangeDetectionStrategy.CheckOnce)
], const [
const []
], () => new HelloCmp()));
}

View File

@ -12,7 +12,7 @@ void initReflector(reflector) {
..registerType(
HelloCmp,
new ReflectionInfo(const [
const Component(events: ['onFoo', 'onBar'])
const Component(events: const ['onFoo', 'onBar'])
], const [
const []
], () => new HelloCmp()));

View File

@ -2,7 +2,19 @@ library examples.hello_world.index_common_dart.ng_deps.dart;
import 'hello.dart';
import 'package:angular2/angular2.dart'
show Component, Directive, View, NgElement, LifecycleEvent;
show
Component,
Directive,
View,
NgElement,
OnChanges,
OnDestroy,
OnInit,
DoCheck,
AfterContentInit,
AfterContentChecked,
AfterViewInit,
AfterViewChecked;
var _visited = false;
void initReflector(reflector) {
@ -11,18 +23,18 @@ void initReflector(reflector) {
reflector
..registerType(
HelloCmp,
new ReflectionInfo(const [
const Component(lifecycle: [
LifecycleEvent.OnChanges,
LifecycleEvent.OnDestroy,
LifecycleEvent.OnInit,
LifecycleEvent.DoCheck,
LifecycleEvent.AfterContentInit,
LifecycleEvent.AfterContentChecked,
LifecycleEvent.AfterViewInit,
LifecycleEvent.AfterViewChecked
])
], const [
const []
], () => new HelloCmp()));
new ReflectionInfo(
const [const Component()],
const [const []],
() => new HelloCmp(),
const [
OnChanges,
OnDestroy,
OnInit,
DoCheck,
AfterContentInit,
AfterContentChecked,
AfterViewInit,
AfterViewChecked
]));
}