diff options
Diffstat (limited to 'node_modules/rxjs/dist/esm5/internal/operators/sample.js')
| -rw-r--r-- | node_modules/rxjs/dist/esm5/internal/operators/sample.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/node_modules/rxjs/dist/esm5/internal/operators/sample.js b/node_modules/rxjs/dist/esm5/internal/operators/sample.js new file mode 100644 index 0000000..feff985 --- /dev/null +++ b/node_modules/rxjs/dist/esm5/internal/operators/sample.js @@ -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(function (source, subscriber) { + var hasValue = false; + var lastValue = null; + source.subscribe(createOperatorSubscriber(subscriber, function (value) { + hasValue = true; + lastValue = value; + })); + innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function () { + if (hasValue) { + hasValue = false; + var value = lastValue; + lastValue = null; + subscriber.next(value); + } + }, noop)); + }); +} +//# sourceMappingURL=sample.js.map
\ No newline at end of file |
