UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

33 lines (32 loc) 1.13 kB
/** * @packageDocumentation * @module translate */ import { OnDestroy } from '@angular/core'; import { Subject } from 'rxjs'; import * as i0 from "@angular/core"; /** * 相对时间管理器服务 * * 用于优化大量相对时间显示的性能,通过共享定时器避免创建过多独立计时器。 * 当页面存在大量相对时间显示时,使用统一的刷新频率来批量更新所有实例。 */ export declare class RelativeTimeManagerService implements OnDestroy { private readonly refreshSubjects; private readonly timers; /** * 获取指定刷新间隔的 Subject * 多个 pipe 实例可以共享同一个刷新频率 */ getRefreshSubject(interval: number): Subject<void>; /** * 释放指定间隔的订阅 * 当没有 pipe 实例使用时,自动清理定时器 */ releaseRefreshSubject(interval: number): void; private startTimer; private stopTimer; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<RelativeTimeManagerService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RelativeTimeManagerService>; }