refactor(web): rename loadMonthGroup to loadSegment API

This commit is contained in:
midzelis
2025-09-18 14:38:09 +00:00
parent 3e9f713d81
commit 8d4978602b
6 changed files with 37 additions and 33 deletions
@@ -199,7 +199,7 @@ export class TimelineManager {
const direction = options?.direction ?? 'earlier';
let { startDayGroup, startAsset } = options ?? {};
for (const monthGroup of this.monthGroupIterator({ direction, startMonthGroup: options?.startMonthGroup })) {
await this.loadMonthGroup(monthGroup.yearMonth, { cancelable: false });
await this.loadSegment(monthGroup.yearMonth, { cancelable: false });
yield* monthGroup.assetsIterator({ startDayGroup, startAsset, direction });
startDayGroup = startAsset = undefined;
}
@@ -388,7 +388,7 @@ export class TimelineManager {
};
}
async loadMonthGroup(yearMonth: TimelineYearMonth, options?: { cancelable: boolean }): Promise<void> {
async loadSegment(yearMonth: TimelineYearMonth, options?: { cancelable: boolean }): Promise<void> {
let cancelable = true;
if (options) {
cancelable = options.cancelable;
@@ -443,7 +443,7 @@ export class TimelineManager {
}
async #loadMonthGroupAtTime(yearMonth: TimelineYearMonth, options?: { cancelable: boolean }) {
await this.loadMonthGroup(yearMonth, options);
await this.loadSegment(yearMonth, options);
return getMonthGroupByDate(this, yearMonth);
}
@@ -455,7 +455,7 @@ export class TimelineManager {
async getRandomMonthGroup() {
const random = Math.floor(Math.random() * this.months.length);
const month = this.months[random];
await this.loadMonthGroup(month.yearMonth, { cancelable: false });
await this.loadSegment(month.yearMonth, { cancelable: false });
return month;
}
@@ -528,7 +528,7 @@ export class TimelineManager {
if (!monthGroup) {
return;
}
await this.loadMonthGroup(dateTime, { cancelable: false });
await this.loadSegment(dateTime, { cancelable: false });
const asset = monthGroup.findClosest(dateTime);
if (asset) {
return asset;