Hyperlinkv0.8.0-beta.28

Process

Process.windowfunctionsrc/Process.ts:1876
(startAt: Date, stopAt: Date): ScheduleWindow
(id: string, startAt: Date, stopAt: Date): ScheduleWindow

A bounded window (start + stop). The leading id is optional.

Process.window(gameStart, gameEnd)            // nameless
Process.window("game-123", gameStart, gameEnd)
schedule
Source src/Process.ts:187623 lines
export function window(startAt: Date, stopAt: Date): ScheduleWindow;
export function window(id: string, startAt: Date, stopAt: Date): ScheduleWindow;
export function window(
  idOrStartAt: string | Date,
  startAtOrStopAt: Date,
  maybeStopAt?: Date,
): ScheduleWindow {
  if (idOrStartAt instanceof Date) {
    return {
      id: Option.none(),
      startAt: idOrStartAt,
      stopAt: Option.some(startAtOrStopAt),
    };
  }
  if (maybeStopAt === undefined) {
    throw new Error("Process.window(id, startAt, stopAt): stopAt is required");
  }
  return {
    id: toWindowId(idOrStartAt),
    startAt: startAtOrStopAt,
    stopAt: Option.some(maybeStopAt),
  };
}