( scheduleFn: (callback: VoidFunction, injector: Injector) => VoidFunction, )
| 76 | * Schedules triggering of a defer block for `on idle` and `on timer` conditions. |
| 77 | */ |
| 78 | export function scheduleDelayedTrigger( |
| 79 | scheduleFn: (callback: VoidFunction, injector: Injector) => VoidFunction, |
| 80 | ) { |
| 81 | const lView = getLView(); |
| 82 | const tNode = getCurrentTNode()!; |
| 83 | |
| 84 | renderPlaceholder(lView, tNode); |
| 85 | |
| 86 | // Exit early to avoid invoking `scheduleFn`, which would |
| 87 | // add `setTimeout` call and potentially delay serialization |
| 88 | // on the server unnecessarily. |
| 89 | if (!shouldTriggerDeferBlock(TriggerType.Regular, lView)) return; |
| 90 | |
| 91 | const injector = lView[INJECTOR]; |
| 92 | const lDetails = getLDeferBlockDetails(lView, tNode); |
| 93 | |
| 94 | const cleanupFn = scheduleFn( |
| 95 | () => triggerDeferBlock(TriggerType.Regular, lView, tNode), |
| 96 | injector, |
| 97 | ); |
| 98 | storeTriggerCleanupFn(TriggerType.Regular, lDetails, cleanupFn); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Schedules prefetching for `on idle` and `on timer` triggers. |
no test coverage detected
searching dependent graphs…