From 08a81850721880ae014987c0dcaac7fd0ad73955 Mon Sep 17 00:00:00 2001 From: natmegs Date: Thu, 21 Dec 2017 20:57:15 -0800 Subject: [PATCH] docs(operators): add documentation for operator buffer Add initial version of documentation for transformation operator 'buffer' --- src/operator-docs/transformation/buffer.ts | 55 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/src/operator-docs/transformation/buffer.ts b/src/operator-docs/transformation/buffer.ts index 5f16f362..aadd0ab1 100644 --- a/src/operator-docs/transformation/buffer.ts +++ b/src/operator-docs/transformation/buffer.ts @@ -1,6 +1,57 @@ import { OperatorDoc } from '../operator.model'; export const buffer: OperatorDoc = { - 'name': 'buffer', - 'operatorType': 'transformation' + name: 'buffer', + operatorType: 'transformation', + signature: 'public buffer(closingNotifier: Observable): Observable', + useInteractiveMarbles: true, + parameters: [ + { + name: 'closingNotifier', + type: 'Observable', + attribute: '', + description: + 'An Observable that signals the buffer to be emitted on the output Observable.' + } + ], + marbleUrl: 'http://reactivex.io/rxjs/img/buffer.png', + shortDescription: { + description: ` + Buffers the source Observable values until closingNotifier + emits. + ` + }, + walkthrough: { + description: ` +

+ Buffers the incoming Observable values until the given + closingNotifier Observable emits a value, at which point + it emits the buffer on the output Observable and starts a new buffer internally, + awaiting the next time closingNotifier emits. +

+ ` + }, + examples: [ + { + name: 'On every click, emit array of most recent interval events', + code: ` + const clicks = Rx.Observable.fromEvent(document, 'click'); + const interval = Rx.Observable.interval(1000); + const buffered = interval.buffer(clicks); + buffered.subscribe(x => console.log(x)); + `, + externalLink: { + platform: 'JSBin', + url: 'http://jsbin.com/xetemuteho/embed?js,console,output' + } + } + ], + relatedOperators: [ + 'bufferCount', + 'bufferTime', + 'bufferToggle', + 'bufferWhen', + 'window' + ], + additionalResources: [] };