/**
 * A class that dispatches actions at regular intervals.
 *
 */
export class IntervalReader {
    /**
     * Constructs a new interval reader.
     *
     * @param action - The action that should be dispatched on each interval.
     * @param intervalInSeconds - The interval duration in seconds.
     */
    constructor(action, intervalInSeconds) {
        this.action = action;
        this.intervalInSeconds = intervalInSeconds;
    }
    /**
     * Initializes the reader with an action dispatcher.
     *
     * @param actionDispatcher - The function to be called when dispatching action.
     */
    initialize(actionDispatcher) {
        this.actionDispatcher = actionDispatcher;
    }
    /**
     * Starts the action dispatch at the specified intervals.
     */
    start() {
        this.intervalId = setInterval(() => {
            this.actionDispatcher(this.action, { driver: 'intervalDriver ' }, false);
        }, 1000 * this.intervalInSeconds); // Example: every 1 second
    }
    /**
     * Stops the interval-driven action dispatch.
     */
    stop() {
        if (this.intervalId) {
            clearInterval(this.intervalId);
        }
    }
}
//# sourceMappingURL=IntervalReader.js.map