/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { AbstractType } from '../interface/type'; import { InjectionToken } from '../di/injection_token'; import type { EnvironmentProviders } from '../di/interface/provider'; /** * Service which configures custom 'on idle' behavior for Angular features like `@defer`. * * @publicApi * * @see [Customizing `idle` behavior](guide/templates/defer#customizing-idle-behavior) * */ export interface IdleService { /** * Schedule `callback` to be executed when the current application or browser is considered idle. * * @returns an id which allows the scheduled callback to be cancelled before it executes. */ requestOnIdle(callback: (deadline?: IdleDeadline) => void, options?: IdleRequestOptions): number; /** * Cancel a previously scheduled callback using the id associated with it. */ cancelOnIdle(id: number): void; } export declare const IDLE_SERVICE: InjectionToken; /** * Configures Angular to use the given DI token as its `IdleService`. * * The given token must be available for injection from the root injector, and the injected value * must implement the `IdleService` interface. * * @publicApi * * @see [Customizing `idle` behavior](guide/templates/defer#customizing-idle-behavior) */ export declare function provideIdleServiceWith(useExisting: AbstractType | InjectionToken): EnvironmentProviders;