MCPcopy Index your code
hub / github.com/angular/angular / callHook

Function callHook

packages/core/src/render3/hooks.ts:305–324  ·  view source on GitHub ↗

* Execute one hook against the current `LView`. * * @param currentView The current view * @param initPhaseState the current state of the init phase * @param arr The array in which the hooks are found * @param i The current index within the hook data array

(currentView: LView, initPhase: InitPhaseState, arr: HookData, i: number)

Source from the content-addressed store, hash-verified

303 * @param i The current index within the hook data array
304 */
305function callHook(currentView: LView, initPhase: InitPhaseState, arr: HookData, i: number) {
306 const isInitHook = (arr[i] as number) < 0;
307 const hook = arr[i + 1] as () => void;
308 const directiveIndex = isInitHook ? -arr[i] : (arr[i] as number);
309 const directive = currentView[directiveIndex];
310 if (isInitHook) {
311 const indexWithintInitPhase = currentView[FLAGS] >> LViewFlags.IndexWithinInitPhaseShift;
312 // The init phase state must be always checked here as it may have been recursively updated.
313 if (
314 indexWithintInitPhase <
315 currentView[PREORDER_HOOK_FLAGS] >> PreOrderHookFlags.NumberOfInitHooksCalledShift &&
316 (currentView[FLAGS] & LViewFlags.InitPhaseStateMask) === initPhase
317 ) {
318 currentView[FLAGS] += LViewFlags.IndexWithinInitPhaseIncrementer;
319 callHookInternal(directive, hook);
320 }
321 } else {
322 callHookInternal(directive, hook);
323 }
324}

Callers 1

callHooksFunction · 0.85

Calls 1

callHookInternalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…