diff --git a/rxjs-docs b/rxjs-docs deleted file mode 160000 index 5059b48c..00000000 --- a/rxjs-docs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5059b48c083853b48eeabdc2272c56edf4e2443b diff --git a/src/operator-docs/transformation/windowWhen.ts b/src/operator-docs/transformation/windowWhen.ts index 90829e20..e831ce7c 100644 --- a/src/operator-docs/transformation/windowWhen.ts +++ b/src/operator-docs/transformation/windowWhen.ts @@ -1,6 +1,87 @@ import { OperatorDoc } from '../operator.model'; export const windowWhen: OperatorDoc = { - 'name': 'windowWhen', - 'operatorType': 'transformation' + name: 'windowWhen', + operatorType: 'transformation', + signature: `public windowWhen(closingSelector: function(): Observable): Observable`, + parameters: [ + { + name: 'closingSelector', + type: 'function(): Observable', + attribute: '', + description: ` + 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.` + } + ], + marbleUrl: 'http://reactivex.io/rxjs/img/windowWhen.png', + shortDescription: { + description: ` + Branch out the source Observable values as a nested Observable using a factory function of + closing Observables to determine when to start a new window.`, + extras: [ + { + type: 'Tip', + text: ` + It's like bufferWhen, + but emits a nested Observable instead of an array. + ` + } + ] + }, + walkthrough: { + description: ` + 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.` + }, + examples: [ + { + name: + 'Emit only the first two clicks events in every window of [1-5] random seconds', + code: ` + import { fromEvent } from 'rxjs/observable/fromEvent'; + import { interval } from 'rxjs/observable/interval'; + import { mergeAll, tap, windowWhen } from 'rxjs/operators'; + + const clicks = fromEvent(document, 'click'); + const result = clicks.pipe( + windowWhen(() => interval(3000)), + tap(() => console.log('Window Initated!')) + ); + result.pipe(mergeAll()).subscribe(x => console.log(x)); + + /* + Example console output + 'Window Initated!' + 'Window Initated!' + 'Window Initated!' + 'Window Initated!' //clicked on document + [object MouseEvent] { + altKey: false, + AT_TARGET: 2, + bubbles: true, + BUBBLING_PHASE: 3, + button: 0, + buttons: 0, + cancelable: true, + cancelBubble: false, + .... //Entire object properties + } + */ + `, + externalLink: { + platform: 'JSBin', + url: 'http://jsbin.com/zegowub/embed?js,console,output' + } + } + ], + relatedOperators: [ + 'window', + 'windowCount', + 'windowTime', + 'windowToggle', + 'bufferWhen' + ] };