export class Interval {
    _period;
    _sideEffect;
    _intervalId;
    _tick;
    constructor(period, sideEffect) {
        this._period = period;
        this._sideEffect = sideEffect;
        this._intervalId = null;
        this._tick = 0;
    }
    /**
     * Starts emitting values at the specified interval.
     */
    start() {
        this._intervalId = setInterval(() => {
            this._sideEffect(this._tick);
            this._tick += 100;
        }, this._period);
    }
    /**
     * Stops emitting values.
     */
    stop() {
        if (this._intervalId !== null) {
            clearInterval(this._intervalId);
            this._intervalId = null;
        }
    }
    destroy() {
        this.stop();
    }
}
//# sourceMappingURL=Interval.js.map