initial commit - far from runnable
This commit is contained in:
commit
db057ce342
8614 changed files with 1032171 additions and 0 deletions
23
node_modules/rxjs/dist/esm/internal/operators/sample.js
generated
vendored
Normal file
23
node_modules/rxjs/dist/esm/internal/operators/sample.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { operate } from '../util/lift';
|
||||
import { noop } from '../util/noop';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function sample(notifier) {
|
||||
return operate((source, subscriber) => {
|
||||
let hasValue = false;
|
||||
let lastValue = null;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
hasValue = true;
|
||||
lastValue = value;
|
||||
}));
|
||||
innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => {
|
||||
if (hasValue) {
|
||||
hasValue = false;
|
||||
const value = lastValue;
|
||||
lastValue = null;
|
||||
subscriber.next(value);
|
||||
}
|
||||
}, noop));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=sample.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue