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 1.1KB

123456789101112131415161718192021222324252627282930
  1. /** PURE_IMPORTS_START _scheduler_async,_scan,_observable_defer,_map PURE_IMPORTS_END */
  2. import { async } from '../scheduler/async';
  3. import { scan } from './scan';
  4. import { defer } from '../observable/defer';
  5. import { map } from './map';
  6. export function timeInterval(scheduler) {
  7. if (scheduler === void 0) {
  8. scheduler = async;
  9. }
  10. return function (source) {
  11. return defer(function () {
  12. return source.pipe(scan(function (_a, value) {
  13. var current = _a.current;
  14. return ({ value: value, current: scheduler.now(), last: current });
  15. }, { current: scheduler.now(), value: undefined, last: undefined }), map(function (_a) {
  16. var current = _a.current, last = _a.last, value = _a.value;
  17. return new TimeInterval(value, current - last);
  18. }));
  19. });
  20. };
  21. }
  22. var TimeInterval = /*@__PURE__*/ (function () {
  23. function TimeInterval(value, interval) {
  24. this.value = value;
  25. this.interval = interval;
  26. }
  27. return TimeInterval;
  28. }());
  29. export { TimeInterval };
  30. //# sourceMappingURL=timeInterval.js.map