Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
672 bytes
|
Line | |
---|
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 |
---|
Note:
See
TracBrowser
for help on using the repository browser.