diff --git a/src/operator-docs/utility/do.ts b/src/operator-docs/utility/do.ts index 55609103..b9c543a2 100644 --- a/src/operator-docs/utility/do.ts +++ b/src/operator-docs/utility/do.ts @@ -1,6 +1,73 @@ import { OperatorDoc } from '../operator.model'; export const doOperator: OperatorDoc = { - 'name': 'do', - 'operatorType': 'utility' + name: 'do', + operatorType: 'utility', + signature: + 'public do(nextOrObserver: Observer | function, error: function, complete: function): Observable', + parameters: [ + { + name: 'nextOrObserver', + type: 'Observer|function', + attribute: 'optional', + description: 'A normal Observer object or a callback for `next`.' + }, + { + name: 'error', + type: 'function', + attribute: 'optional', + description: 'Callback for errors in the source.' + }, + { + name: 'complete', + type: 'function', + attribute: 'optional', + description: 'Callback for the completion of the source.' + } + ], + marbleUrl: 'http://reactivex.io/rxjs/img/do.png', + shortDescription: { + description: `Perform a side effect for every emission on the source Observable, but return + an Observable that is identical to the source. + Intercepts each emission on the source and runs a + function, but returns an output which is identical to the source as long as errors don't + occur.` + }, + walkthrough: { + description: ` +
Returns a mirrored Observable of the source Observable, + but modified so that the provided Observer is called to perform a side effect for every + value, error, and completion emitted by the source. Any errors that are thrown in + the aforementioned Observer or handlers are safely sent down the error path + of the output Observable. +
++ This operator is useful for debugging your Observables for the correct values + or performing other side effects. +
+
+ Note: this is different to a subscribe on the Observable. If the Observable
+ returned by do is not subscribed, the side effects specified by the
+ Observer will never happen. do therefore simply spies on existing
+ execution, it does not trigger an execution to happen like subscribe does.