Skip to content

Commit

Permalink
docs(windowWhen): update documentation and marble diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
jakovljevic-mladen committed Sep 1, 2022
1 parent 26ad3c4 commit d79cc63
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions docs_app/src/assets/images/marble-diagrams/windowWhen.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs_app/tools/marbles/diagrams/windowWhen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[styles]
event_radius = 33
operator_height = 60
completion_height = 80

---a---b---c---d---e---f---g---h---|

-------------x|
-------------x|
-------------x|

> windowWhen()

x = ---a---b---c-|

y = --d---e---f---g|

z = -g---h---|

x------------y------------z--------|
20 changes: 11 additions & 9 deletions src/internal/operators/windowWhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import { noop } from '../util/noop';
* <span class="informal">It's like {@link bufferWhen}, but emits a nested
* Observable instead of an array.</span>
*
* ![](windowWhen.png)
* ![](windowWhen.svg)
*
* Returns an Observable that emits windows of items it collects from the source
* Observable. The output Observable emits connected, non-overlapping windows.
* It emits the current window and opens a new one whenever the Observable
* produced by the specified `closingSelector` function emits an item. The first
* window is opened immediately when subscribing to the output Observable.
* Returns an Observable that emits Observable windows of items it collects from
* the source Observable. The output Observable emits connected, non-overlapping
* windows. It emits the current window immediately when subscribing to the source
* Observable and opens a new one whenever the Observable produced by the specified
* `closingSelector` function emits `next`. When an Observable returned by the
* `closingSelector` emits `next`, the previous window completes and a new window
* is emitted to the output subscriber.
*
* ## Example
*
Expand All @@ -45,9 +47,9 @@ import { noop } from '../util/noop';
* @see {@link windowToggle}
* @see {@link bufferWhen}
*
* @param {function(): Observable} closingSelector A function that takes no
* arguments and returns an Observable that signals (on either `next` or
* `complete`) when to close the previous window and start a new one.
* @param closingSelector A function that takes no arguments and returns an
* {@link ObservableInput} (that gets converted to Observable) that signals
* (only on `next`) when to close the previous window and start a new one.
* @return A function that returns an Observable of windows, which in turn are
* Observables.
*/
Expand Down

0 comments on commit d79cc63

Please sign in to comment.