mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): implement missing OnDestroy for schedulers
Implements the missing OnDestroy interface. Also removes an unused generic from a performance logging function.
This commit is contained in:
committed by
Kristiyan Kostadinov
parent
66637f1c3f
commit
02e80b4ea2
@@ -6,6 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import type {OnDestroy} from '../core';
|
||||
import {Injector, inject, ɵɵdefineInjectable} from '../di';
|
||||
import {NgZone} from '../zone';
|
||||
|
||||
@@ -39,7 +40,7 @@ const _cancelIdleCallback = () =>
|
||||
* to avoid calling `requestIdleCallback` for each defer block (e.g. if
|
||||
* defer blocks are defined inside a for loop).
|
||||
*/
|
||||
export class IdleScheduler {
|
||||
export class IdleScheduler implements OnDestroy {
|
||||
// Indicates whether current callbacks are being invoked.
|
||||
executingCallbacks = false;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import type {OnDestroy} from '../core';
|
||||
import {Injector, ɵɵdefineInjectable} from '../di';
|
||||
import {arrayInsert2, arraySplice} from '../util/array_utils';
|
||||
import {NgZone} from '../zone';
|
||||
@@ -39,7 +40,7 @@ export function scheduleTimerTrigger(delay: number, callback: VoidFunction, inje
|
||||
* to avoid calling `setTimeout` for each defer block (e.g. if defer blocks
|
||||
* are created inside a for loop).
|
||||
*/
|
||||
export class TimerScheduler {
|
||||
export class TimerScheduler implements OnDestroy {
|
||||
// Indicates whether current callbacks are being invoked.
|
||||
executingCallbacks = false;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ let enablePerfLogging = false;
|
||||
* Function that will start measuring against the performance API
|
||||
* Should be used in pair with stopMeasuring
|
||||
*/
|
||||
export function startMeasuring<T>(label: string): void {
|
||||
export function startMeasuring(label: string): void {
|
||||
if (!enablePerfLogging) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user