Buckets:
| import { operate } from '../util/lift'; | |
| import { noop } from '../util/noop'; | |
| import { createOperatorSubscriber } from './OperatorSubscriber'; | |
| import { innerFrom } from '../observable/innerFrom'; | |
| export function debounce(durationSelector) { | |
| return operate(function (source, subscriber) { | |
| var hasValue = false; | |
| var lastValue = null; | |
| var durationSubscriber = null; | |
| var emit = function () { | |
| durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe(); | |
| durationSubscriber = null; | |
| if (hasValue) { | |
| hasValue = false; | |
| var value = lastValue; | |
| lastValue = null; | |
| subscriber.next(value); | |
| } | |
| }; | |
| source.subscribe(createOperatorSubscriber(subscriber, function (value) { | |
| durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe(); | |
| hasValue = true; | |
| lastValue = value; | |
| durationSubscriber = createOperatorSubscriber(subscriber, emit, noop); | |
| innerFrom(durationSelector(value)).subscribe(durationSubscriber); | |
| }, function () { | |
| emit(); | |
| subscriber.complete(); | |
| }, undefined, function () { | |
| lastValue = durationSubscriber = null; | |
| })); | |
| }); | |
| } | |
| //# sourceMappingURL=debounce.js.map |
Xet Storage Details
- Size:
- 1.43 kB
- Xet hash:
- 399e66b62ae21a34c46e50ae919023e7f44dcf52ef2710fb44413efe541e579e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.