mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-26 18:43:43 +03:00
parent
3e09b0588a
commit
e4f5388076
|
@ -141,7 +141,7 @@ export class MenuService {
|
||||||
onHashChange(hash?: string) {
|
onHashChange(hash?: string) {
|
||||||
if (hash == undefined) return;
|
if (hash == undefined) return;
|
||||||
let activated = this.activateByHash(hash);
|
let activated = this.activateByHash(hash);
|
||||||
if (!this.tasks.empty) {
|
if (!this.tasks.processed) {
|
||||||
this.tasks.start(this.activeIdx, this);
|
this.tasks.start(this.activeIdx, this);
|
||||||
this.scrollService.setStickElement(this.getCurrentEl());
|
this.scrollService.setStickElement(this.getCurrentEl());
|
||||||
if (activated) this.scrollToActive();
|
if (activated) this.scrollToActive();
|
||||||
|
|
|
@ -31,6 +31,7 @@ export class LazyTasksService {
|
||||||
private _tasks = [];
|
private _tasks = [];
|
||||||
private _current: number = 0;
|
private _current: number = 0;
|
||||||
private _syncCount: number = 0;
|
private _syncCount: number = 0;
|
||||||
|
private _emptyProcessed = false;
|
||||||
private menuService;
|
private menuService;
|
||||||
|
|
||||||
public loadProgress = new BehaviorSubject<number>(0);
|
public loadProgress = new BehaviorSubject<number>(0);
|
||||||
|
@ -38,8 +39,10 @@ export class LazyTasksService {
|
||||||
constructor(public optionsService: OptionsService) {
|
constructor(public optionsService: OptionsService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
get empty() {
|
get processed() {
|
||||||
return this._current === this._tasks.length;
|
let res = this._tasks.length && (this._current >= this._tasks.length) || this._emptyProcessed;
|
||||||
|
if (!this._tasks.length) this._emptyProcessed = true;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
set syncCount(n: number) {
|
set syncCount(n: number) {
|
||||||
|
@ -97,10 +100,17 @@ export class LazyTasksService {
|
||||||
} else {
|
} else {
|
||||||
this.sortTasks(idx);
|
this.sortTasks(idx);
|
||||||
}
|
}
|
||||||
|
syncCount = Math.min(syncCount, this._tasks.length);
|
||||||
if (this.allSync) syncCount = this._tasks.length;
|
if (this.allSync) syncCount = this._tasks.length;
|
||||||
for (var i = this._current; i < syncCount; i++) {
|
for (var i = this._current; i < syncCount; i++) {
|
||||||
this.nextTaskSync();
|
this.nextTaskSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this._tasks.length) {
|
||||||
|
this.loadProgress.next(100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.nextTask();
|
this.nextTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user