Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

timeInterval.js 672B

12345678910111213141516
  1. import { async } from '../scheduler/async';
  2. import { scan } from './scan';
  3. import { defer } from '../observable/defer';
  4. import { map } from './map';
  5. export function timeInterval(scheduler = async) {
  6. return (source) => defer(() => {
  7. return source.pipe(scan(({ current }, value) => ({ value, current: scheduler.now(), last: current }), { current: scheduler.now(), value: undefined, last: undefined }), map(({ current, last, value }) => new TimeInterval(value, current - last)));
  8. });
  9. }
  10. export class TimeInterval {
  11. constructor(value, interval) {
  12. this.value = value;
  13. this.interval = interval;
  14. }
  15. }
  16. //# sourceMappingURL=timeInterval.js.map