refactor(directives): directives use declare that they listen to onChange in the annotations

This commit is contained in:
vsavkin
2015-02-06 13:19:47 -08:00
parent ee3f709fbf
commit 9240b09011
7 changed files with 91 additions and 27 deletions

View File

@ -1,5 +1,5 @@
import {ABSTRACT, CONST, normalizeBlank} from 'angular2/src/facade/lang';
import {List} from 'angular2/src/facade/collection';
import {ABSTRACT, CONST, normalizeBlank, isPresent} from 'angular2/src/facade/lang';
import {ListWrapper, List} from 'angular2/src/facade/collection';
import {TemplateConfig} from './template_config';
@ABSTRACT()
@ -30,6 +30,10 @@ export class Directive {
this.bind = bind;
this.lifecycle = lifecycle;
}
hasLifecycleHook(hook:string):boolean {
return isPresent(this.lifecycle) ? ListWrapper.contains(this.lifecycle, hook) : false;
}
}
export class Component extends Directive {
@ -133,4 +137,5 @@ export class Template extends Directive {
}
}
export var onDestroy = "onDestroy";
export const onDestroy = "onDestroy";
export const onChange = "onChange";