refactor(ivy): combine lifecycleStage with LViewFlags (#24263)

PR Close #24263
This commit is contained in:
Kara Erickson
2018-06-01 18:54:23 -07:00
committed by Victor Berchet
parent 44856bfc2f
commit cb65724761
3 changed files with 20 additions and 39 deletions

View File

@ -9,7 +9,8 @@
import {assertEqual} from './assert';
import {DirectiveDef} from './interfaces/definition';
import {TNodeFlags} from './interfaces/node';
import {HookData, LView, LifecycleStage, TView} from './interfaces/view';
import {HookData, LView, LViewFlags, TView} from './interfaces/view';
/**
* If this is the first template pass, any ngOnInit or ngDoCheck hooks will be queued into
@ -97,9 +98,9 @@ function queueDestroyHooks(def: DirectiveDef<any>, tView: TView, i: number): voi
* @param currentView The current view
*/
export function executeInitHooks(currentView: LView, tView: TView, creationMode: boolean): void {
if (currentView.lifecycleStage === LifecycleStage.Init) {
if (currentView.flags & LViewFlags.RunInit) {
executeHooks(currentView.directives !, tView.initHooks, tView.checkHooks, creationMode);
currentView.lifecycleStage = LifecycleStage.AfterInit;
currentView.flags &= ~LViewFlags.RunInit;
}
}