From e4fa1e69e7ebfb627c7198fd1a9881e9327ec4d4 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 28 Jun 2025 17:26:46 -0700 Subject: initial commit: scaffolding --- .../rxjs/dist/esm/internal/operators/sample.js | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 node_modules/rxjs/dist/esm/internal/operators/sample.js (limited to 'node_modules/rxjs/dist/esm/internal/operators/sample.js') diff --git a/node_modules/rxjs/dist/esm/internal/operators/sample.js b/node_modules/rxjs/dist/esm/internal/operators/sample.js new file mode 100644 index 0000000..5c36c57 --- /dev/null +++ b/node_modules/rxjs/dist/esm/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((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 \ No newline at end of file -- cgit v1.2.3