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C;QAC/B,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QAEpB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACvD,CAAC;IACH,6BAAC;AAAD,CAAC,AAhBD,CAAwC,uBAAU,GAgBjD","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { IScheduler } from '../Scheduler';\nimport { async } from '../scheduler/async';\nimport { OperatorFunction } from '../interfaces';\n\nexport function timeInterval<T>(scheduler: IScheduler = async): OperatorFunction<T, TimeInterval<T>> {\n return (source: Observable<T>) => source.lift(new TimeIntervalOperator(scheduler));\n}\n\nexport class TimeInterval<T> {\n constructor(public value: T, public interval: number) {\n\n }\n};\n\nclass TimeIntervalOperator<T> implements Operator<T, TimeInterval<T>> {\n constructor(private scheduler: IScheduler) {\n\n }\n\n call(observer: Subscriber<TimeInterval<T>>, source: any): any {\n return source.subscribe(new TimeIntervalSubscriber(observer, this.scheduler));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass TimeIntervalSubscriber<T> extends Subscriber<T> {\n private lastTime: number = 0;\n\n constructor(destination: Subscriber<TimeInterval<T>>, private scheduler: IScheduler) {\n super(destination);\n\n this.lastTime = scheduler.now();\n }\n\n protected _next(value: T) {\n let now = this.scheduler.now();\n let span = now - this.lastTime;\n this.lastTime = now;\n\n this.destination.next(new TimeInterval(value, span));\n }\n}\n"]}
|