Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

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