Define a new event to indicate shuttle is near a stop

This commit is contained in:
2025-11-19 11:48:22 -08:00
parent dbcc882a18
commit 2ff71b0dd1

View File

@@ -4,6 +4,7 @@ import type EventEmitter from "node:events";
export const ShuttleRepositoryEvent = { export const ShuttleRepositoryEvent = {
SHUTTLE_UPDATED: "shuttleUpdated", SHUTTLE_UPDATED: "shuttleUpdated",
SHUTTLE_REMOVED: "shuttleRemoved", SHUTTLE_REMOVED: "shuttleRemoved",
SHUTTLE_IS_NEAR_NEXT_STOP: "shuttleIsNearNextStop",
SHUTTLE_WILL_ARRIVE_AT_STOP: "shuttleArrivedAtStop", SHUTTLE_WILL_ARRIVE_AT_STOP: "shuttleArrivedAtStop",
SHUTTLE_WILL_LEAVE_STOP: "shuttleWillLeaveStop", SHUTTLE_WILL_LEAVE_STOP: "shuttleWillLeaveStop",
} as const; } as const;
@@ -18,6 +19,8 @@ export interface ShuttleWillArriveAtStopPayload {
willArriveAt: ShuttleStopArrival; willArriveAt: ShuttleStopArrival;
}; };
export type ShuttleIsNearStopPayload = ShuttleWillArriveAtStopPayload;
export interface ShuttleWillLeaveStopPayload { export interface ShuttleWillLeaveStopPayload {
stopArrivalThatShuttleIsLeaving: ShuttleStopArrival; stopArrivalThatShuttleIsLeaving: ShuttleStopArrival;
} }
@@ -25,6 +28,7 @@ export interface ShuttleWillLeaveStopPayload {
export interface ShuttleRepositoryEventPayloads { export interface ShuttleRepositoryEventPayloads {
[ShuttleRepositoryEvent.SHUTTLE_UPDATED]: IShuttle, [ShuttleRepositoryEvent.SHUTTLE_UPDATED]: IShuttle,
[ShuttleRepositoryEvent.SHUTTLE_REMOVED]: IShuttle, [ShuttleRepositoryEvent.SHUTTLE_REMOVED]: IShuttle,
[ShuttleRepositoryEvent.SHUTTLE_IS_NEAR_NEXT_STOP]: ShuttleIsNearStopPayload,
[ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP]: ShuttleWillArriveAtStopPayload, [ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP]: ShuttleWillArriveAtStopPayload,
[ShuttleRepositoryEvent.SHUTTLE_WILL_LEAVE_STOP]: ShuttleWillLeaveStopPayload, [ShuttleRepositoryEvent.SHUTTLE_WILL_LEAVE_STOP]: ShuttleWillLeaveStopPayload,
} }