aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/rxjs/dist/esm/internal/operators/sample.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/rxjs/dist/esm/internal/operators/sample.js')
-rw-r--r--node_modules/rxjs/dist/esm/internal/operators/sample.js23
1 files changed, 23 insertions, 0 deletions
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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage