Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/zone-spec/fake-async-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const timers = {

class Scheduler {
// Next scheduler id.
public nextId: number = 1;
public static nextId: number = 1;

// Scheduler queue with the tuple of end time and callback function - sorted by end time.
private _schedulerQueue: ScheduledFunction[] = [];
Expand All @@ -90,7 +90,7 @@ class Scheduler {
scheduleFunction(
cb: Function, delay: number, args: any[] = [], isPeriodic: boolean = false,
isRequestAnimationFrame: boolean = false, id: number = -1): number {
let currentId: number = id < 0 ? this.nextId++ : id;
let currentId: number = id < 0 ? Scheduler.nextId++ : id;
let endTime = this._currentTime + delay;

// Insert so that scheduler queue remains sorted by end time.
Expand Down Expand Up @@ -292,7 +292,7 @@ class FakeAsyncTestZoneSpec implements ZoneSpec {
}

private _setTimeout(fn: Function, delay: number, args: any[], isTimer = true): number {
let removeTimerFn = this._dequeueTimer(this._scheduler.nextId);
let removeTimerFn = this._dequeueTimer(Scheduler.nextId);
// Queue the callback and dequeue the timer on success and error.
let cb = this._fnAndFlush(fn, {onSuccess: removeTimerFn, onError: removeTimerFn});
let id = this._scheduler.scheduleFunction(cb, delay, args, false, !isTimer);
Expand All @@ -308,7 +308,7 @@ class FakeAsyncTestZoneSpec implements ZoneSpec {
}

private _setInterval(fn: Function, interval: number, args: any[]): number {
let id = this._scheduler.nextId;
let id = Scheduler.nextId;
let completers = {onSuccess: null as any, onError: this._dequeuePeriodicTimer(id)};
let cb = this._fnAndFlush(fn, completers);

Expand Down