pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://angular.dev/api/core/PendingTasks

heme === 'auto' && prefersDark)) { documentClassList.add(DARK_MODE_CLASS_NAME); } else { documentClassList.add(LIGHT_MODE_CLASS_NAME); } if (location.search.includes('uwu')) { documentClassList.add('uwu'); } PendingTasks • Angular
    • Overview
@angular/core

PendingTasks

Class
stablesince v20.0

Service that keeps track of pending tasks contributing to the stableness of Angular application. While several existing Angular services (ex.: HttpClient) will internally manage tasks influencing stability, this API gives control over stability to library and application developers for specific cases not covered by Angular internals.

API

    
      class PendingTasks {}
    
    

add

() => void

Adds a new task that should block application's stability.

@returns() => void

A cleanup function that removes a task when called.

run

void

Runs an asynchronous function and blocks the application's stability until the function completes.

pendingTasks.run(async () => {
  const userData = await fetch('/api/user');
  this.userData.set(userData);
});
@paramfn() => Promise<unknown>

The asynchronous function to execute

@returnsvoid

Description

Service that keeps track of pending tasks contributing to the stableness of Angular application. While several existing Angular services (ex.: HttpClient) will internally manage tasks influencing stability, this API gives control over stability to library and application developers for specific cases not covered by Angular internals.

The concept of stability comes into play in several important scenarios:

  • SSR process needs to wait for the application stability before serializing and sending rendered HTML;
  • tests might want to delay assertions until the application becomes stable;

Usage Notes

const pendingTasks = inject(PendingTasks);
const taskCleanup = pendingTasks.add();
// do work that should block application's stability and then:
taskCleanup();
Jump to details
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy