Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(throttle): fix marble diagram #6638

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs_app/assets/images/marble-diagrams/throttle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs_app/src/assets/images/marble-diagrams/throttle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions docs_app/tools/marbles/diagrams/throttle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-a-xy-----b--x--cxyz-|

----i

----i

----i

> throttle()

-a--------b-----c----|
12 changes: 7 additions & 5 deletions spec/operators/throttle-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { expect } from 'chai';
import { TestScheduler } from 'rxjs/internal/testing/TestScheduler';
import { observableMatcher } from '../helpers/observableMatcher';
import { throttle, mergeMap, mapTo, take } from 'rxjs/operators';
import { of, concat, timer, Observable } from 'rxjs';
import { throttle, mergeMap, take } from 'rxjs/operators';
import { of, Observable } from 'rxjs';

/** @test {throttle} */
describe('throttle', () => {
Expand All @@ -15,9 +15,11 @@ describe('throttle', () => {

it('should immediately emit the first value in each time window', () => {
testScheduler.run(({ cold, hot, expectObservable, expectSubscriptions }) => {
const e1 = hot(' ^a-xy-----b--x--cxxx-|');
const e1 = hot(' -a-xy-----b--x--cxyz-|');
const e1subs = ' ^--------------------!';
const e2 = cold(' ----x----------------');
const e2 = cold(' ----i ');
// ----i
// ----i
const e2subs = [
' -^---! ',
' ----------^---! ',
Expand All @@ -34,7 +36,7 @@ describe('throttle', () => {
});

it('should handle sync source with sync notifier and trailing appropriately', () => {
let results: any[] = [];
const results: any[] = [];
const source = of(1).pipe(throttle(() => of(1), { leading: false, trailing: true }));

source.subscribe({
Expand Down
2 changes: 1 addition & 1 deletion src/internal/operators/throttle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const defaultThrottleConfig: ThrottleConfig = {
* <span class="informal">It's like {@link throttleTime}, but the silencing
* duration is determined by a second Observable.</span>
*
* ![](throttle.png)
* ![](throttle.svg)
*
* `throttle` emits the source Observable values on the output Observable
* when its internal timer is disabled, and ignores source values when the timer
Expand Down