import { Observable, PartialObserver, Subscription } from 'rxjs'; import { SegmentCollection } from './segments/SegmentCollection'; import { TimeSegment } from './segments/TimeSegment'; import { ITimeEmission } from './types/Emission'; import { IGroupParameter, ISegmentConfigShape, ISegmentInterface, ISegmentType, ISequenceConfigShape } from './types/Segment'; import { ISubscribable } from './types/Subscribable'; /** * Initiates a sequence with time period being defined in its constructor. * @param constructor Sequencer must be instantiated with a value for period that is read in * milliseconds. This value becomes static and global to its segments. */ export declare class Sequencer implements ISegmentInterface, ISubscribable { config: ISequenceConfigShape; collection: SegmentCollection; subscription: Subscription; private pauseObserv; private source; private observer; constructor(config: ISequenceConfigShape); /** * Adds a single segment (`CountupSegment` or `CountdownSegment`) to a sequence. * @param ctor A type being subclass of `TimeSegment`, Specifically `CountupSegment` or * `CountdownSegment`. * @param config Config file specifiying `duration` (required) and `states` (optional). When * used inside a group function, the `omitFirst` can be used to omit this segment when its * assigned to the first interval. * @returns An instance of `T` type, which is a subclass of TimeSegment. */ add(ctor: ISegmentType, config: ISegmentConfigShape): T; /** * Multiply its combined `add()` invocations and returns a `TimeSegment`. * @param intervals The number intervals or cycles to be added of segments. Must be 1 or greater * in value. * @param segments Consists of `add()` invocations returns. * @returns An instance of `T` type, which is a subclass of `TimeSegment`. */ group(intervals?: number, ...segments: Array>): T; /** * Starts internal Observable to start emitting. This must be called after the `subscribe()` or * `subscribeWith()` is called. * @returns void. */ start(): void; /** * Pauses internal Observable to start emitting. This must be called after the `subscribe()` or * `subscribeWith()` is called. * @returns void. */ pause(): void; /** * Resets the sequence. This must be called after the `subscribeWith()` is called since a * callback object is needed. * That said, this method will unsubscribe and then subscribe again to "reset" the sequence. * @returns void. */ reset(): void; /** * Returns an Observable object versus a Subscription object which `subscribe()` * returns. Typically `subscribe()` is just used. * @returns Observable. */ publish(): Observable<[ITimeEmission, number]>; /** * Pass in callback functions to "subscribe" to emissions from sots. * * @returns Subscription. */ subscribe(observer: PartialObserver): Subscription; subscribe(next?: (value: ITimeEmission) => void, error?: (error: any) => void, complete?: () => void): Subscription; /** * Unsubscribe the subscription that is create from `subscribe()` or `subscribeWith()`. This also * calls the `remove()` * method. */ unsubscribe(): void; /** * Calls the remove method on the subscription object that was create from `subscribe()` or * `subscribeWith()`. */ remove(): void; }