UNPKG

@microsoft/sp-webpart-base

Version:

SharePoint Framework support for building web parts

48 lines 2.06 kB
import type { _IIdleLoadComponent } from '@microsoft/sp-module-interfaces'; type ComponentId = string; type RequestorId = string; export type IIdleLoadComponentWithRequestorId = _IIdleLoadComponent & { /** * Tracks which component (most likely web part) requested this idle load component. */ requestorIds: RequestorId[]; }; /** * @internal * A factory that manages the loading of idle load components. * It allows components to be loaded when the browser is idle or immediately. */ export declare class IdleLoadComponentFactory { private static _instance; static get instance(): IdleLoadComponentFactory; private _removedComponentIds; private _cancelCallbacks; /** * Resets the idle load component factory, clearing all queued requests. */ reset(): void; /** * Removes the component from the idle load component factory. * @param requestorId - the ID of the requestor that requested this component * @param componentId - the ID of the component to remove */ removeComponent(requestorId: RequestorId, componentId: ComponentId): void; /** * Fetches the idle load components when the browser is idle. * @param components - the idle load components to fetch when the browser is idle * @returns A function that can be called to cancel the idle load component fetching. */ fetchIdleLoadComponentsWhenIdle(components: IIdleLoadComponentWithRequestorId[]): () => void; /** * Fetches the idle load components without waiting for the browser is idle. * @param components - the idle load components to fetch when the browser is idle * @returns A function that can be called to cancel the idle load component fetching. */ fetchIdleLoadComponents(components: IIdleLoadComponentWithRequestorId[]): () => void; private constructor(); private _isComponentRemoved; private _addCancelCallback; private _convertIdleLoadComponentsToPrefectchDependencyQueue; } export {}; //# sourceMappingURL=IdleLoadComponentFactory.d.ts.map