
committed by
Miško Hevery

parent
392d584572
commit
aa8bba4865
@ -236,11 +236,11 @@ export class ViewRef_ implements EmbeddedViewRef<any>, InternalViewRef {
|
||||
get destroyed(): boolean { return (this._view.state & ViewState.Destroyed) !== 0; }
|
||||
|
||||
markForCheck(): void { markParentViewsForCheck(this._view); }
|
||||
detach(): void { this._view.state &= ~ViewState.ChecksEnabled; }
|
||||
detach(): void { this._view.state &= ~ViewState.Attached; }
|
||||
detectChanges(): void { Services.checkAndUpdateView(this._view); }
|
||||
checkNoChanges(): void { Services.checkNoChangesView(this._view); }
|
||||
|
||||
reattach(): void { this._view.state |= ViewState.ChecksEnabled; }
|
||||
reattach(): void { this._view.state |= ViewState.Attached; }
|
||||
onDestroy(callback: Function) {
|
||||
if (!this._view.disposables) {
|
||||
this._view.disposables = [];
|
||||
|
@ -324,9 +324,12 @@ export interface ViewData {
|
||||
*/
|
||||
export const enum ViewState {
|
||||
FirstCheck = 1 << 0,
|
||||
ChecksEnabled = 1 << 1,
|
||||
Errored = 1 << 2,
|
||||
Destroyed = 1 << 3
|
||||
Attached = 1 << 1,
|
||||
ChecksEnabled = 1 << 2,
|
||||
Errored = 1 << 3,
|
||||
Destroyed = 1 << 4,
|
||||
|
||||
CatDetectChanges = Attached | ChecksEnabled,
|
||||
}
|
||||
|
||||
export interface DisposableFn { (): void; }
|
||||
|
@ -211,7 +211,7 @@ function createView(
|
||||
viewContainerParent: null, parentNodeDef,
|
||||
context: null,
|
||||
component: null, nodes,
|
||||
state: ViewState.FirstCheck | ViewState.ChecksEnabled, root, renderer,
|
||||
state: ViewState.FirstCheck | ViewState.CatDetectChanges, root, renderer,
|
||||
oldValues: new Array(def.bindingCount), disposables
|
||||
};
|
||||
return view;
|
||||
@ -542,13 +542,13 @@ function callViewAction(view: ViewData, action: ViewAction) {
|
||||
const viewState = view.state;
|
||||
switch (action) {
|
||||
case ViewAction.CheckNoChanges:
|
||||
if ((viewState & ViewState.ChecksEnabled) &&
|
||||
if ((viewState & ViewState.CatDetectChanges) === ViewState.CatDetectChanges &&
|
||||
(viewState & (ViewState.Errored | ViewState.Destroyed)) === 0) {
|
||||
checkNoChangesView(view);
|
||||
}
|
||||
break;
|
||||
case ViewAction.CheckAndUpdate:
|
||||
if ((viewState & ViewState.ChecksEnabled) &&
|
||||
if ((viewState & ViewState.CatDetectChanges) === ViewState.CatDetectChanges &&
|
||||
(viewState & (ViewState.Errored | ViewState.Destroyed)) === 0) {
|
||||
checkAndUpdateView(view);
|
||||
}
|
||||
|
Reference in New Issue
Block a user