From 7251390b705519ca906936aeb1bcf23bfd272d1b Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Mon, 22 Feb 2016 21:05:02 +0200 Subject: [PATCH] docs(operators): fix ESDoc build to put operators under Observable class This moves operators from being top-level functions (they are not, because they are added/monkey-patched to the Observable type) to being methods under the Observable class. --- esdoc.json | 3 ++ src/Observable.ts | 33 ++++++------ src/observable/ArrayObservable.ts | 18 +++++++ src/observable/BoundCallbackObservable.ts | 18 +++++++ src/observable/BoundNodeCallbackObservable.ts | 14 +++++ src/observable/DeferObservable.ts | 10 ++++ src/observable/EmptyObservable.ts | 10 ++++ src/observable/ErrorObservable.ts | 11 ++++ src/observable/ForkJoinObservable.ts | 10 ++++ src/observable/FromEventObservable.ts | 12 +++++ src/observable/FromEventPatternObservable.ts | 12 +++++ src/observable/FromObservable.ts | 13 +++++ src/observable/IntervalObservable.ts | 11 ++++ src/observable/NeverObservable.ts | 9 ++++ src/observable/PromiseObservable.ts | 11 ++++ src/observable/RangeObservable.ts | 12 +++++ src/observable/TimerObservable.ts | 12 +++++ src/observable/dom/AjaxObservable.ts | 2 +- src/observable/dom/WebSocketSubject.ts | 10 ++++ src/operator/buffer.ts | 4 +- src/operator/bufferCount.ts | 4 +- src/operator/bufferTime.ts | 4 +- src/operator/bufferToggle.ts | 4 +- src/operator/bufferWhen.ts | 4 +- src/operator/cache.ts | 8 +++ src/operator/catch.ts | 2 + src/operator/combineAll.ts | 4 +- src/operator/combineLatest.ts | 28 ++++++---- src/operator/concat.ts | 9 +++- src/operator/concatAll.ts | 4 +- src/operator/concatMap.ts | 4 +- src/operator/concatMapTo.ts | 4 +- src/operator/count.ts | 4 +- src/operator/debounce.ts | 4 +- src/operator/debounceTime.ts | 4 +- src/operator/defaultIfEmpty.ts | 4 +- src/operator/delay.ts | 4 +- src/operator/delayWhen.ts | 4 +- src/operator/dematerialize.ts | 4 +- src/operator/distinct.ts | 4 +- src/operator/distinctKey.ts | 4 +- src/operator/distinctUntilChanged.ts | 4 +- src/operator/distinctUntilKeyChanged.ts | 4 +- src/operator/do.ts | 2 + src/operator/elementAt.ts | 4 +- src/operator/every.ts | 4 +- src/operator/exhaust.ts | 4 +- src/operator/exhaustMap.ts | 4 +- src/operator/expand.ts | 4 +- src/operator/filter.ts | 4 +- src/operator/finally.ts | 4 +- src/operator/find.ts | 4 +- src/operator/findIndex.ts | 4 +- src/operator/first.ts | 4 +- src/operator/groupBy.ts | 4 +- src/operator/ignoreElements.ts | 4 +- src/operator/inspect.ts | 6 +++ src/operator/inspectTime.ts | 7 +++ src/operator/isEmpty.ts | 4 +- src/operator/last.ts | 4 +- src/operator/let.ts | 6 +++ src/operator/map.ts | 4 +- src/operator/mapTo.ts | 4 +- src/operator/materialize.ts | 4 +- src/operator/max.ts | 4 +- src/operator/merge.ts | 11 +++- src/operator/mergeAll.ts | 6 +++ src/operator/mergeMap.ts | 4 +- src/operator/mergeMapTo.ts | 8 +++ src/operator/mergeScan.ts | 8 +++ src/operator/min.ts | 4 +- src/operator/multicast.ts | 4 +- src/operator/observeOn.ts | 7 +++ src/operator/pairwise.ts | 4 +- src/operator/partition.ts | 7 +++ src/operator/pluck.ts | 4 +- src/operator/publish.ts | 4 +- src/operator/publishBehavior.ts | 6 +++ src/operator/publishLast.ts | 5 ++ src/operator/publishReplay.ts | 8 +++ src/operator/race.ts | 9 +++- src/operator/reduce.ts | 4 +- src/operator/repeat.ts | 4 +- src/operator/retry.ts | 4 +- src/operator/retryWhen.ts | 4 +- src/operator/sample.ts | 4 +- src/operator/sampleTime.ts | 7 +++ src/operator/scan.ts | 4 +- src/operator/share.ts | 4 +- src/operator/single.ts | 4 +- src/operator/skip.ts | 4 +- src/operator/skipUntil.ts | 20 +++---- src/operator/skipWhile.ts | 4 +- src/operator/startWith.ts | 4 +- src/operator/subscribeOn.ts | 4 +- src/operator/switch.ts | 4 +- src/operator/switchMap.ts | 4 +- src/operator/switchMapTo.ts | 7 +++ src/operator/take.ts | 6 +++ src/operator/takeLast.ts | 6 +++ src/operator/takeUntil.ts | 6 +++ src/operator/takeWhile.ts | 6 +++ src/operator/throttle.ts | 6 +++ src/operator/throttleTime.ts | 7 +++ src/operator/timeInterval.ts | 6 +++ src/operator/timeout.ts | 8 +++ src/operator/timeoutWith.ts | 8 +++ src/operator/toArray.ts | 5 ++ src/operator/toPromise.ts | 6 +++ src/operator/window.ts | 6 +++ src/operator/windowCount.ts | 7 +++ src/operator/windowTime.ts | 8 +++ src/operator/windowToggle.ts | 7 +++ src/operator/windowWhen.ts | 6 +++ src/operator/withLatestFrom.ts | 2 + src/operator/zip.ts | 14 +++++ src/operator/zipAll.ts | 6 +++ tools/custom-esdoc-plugin.js | 53 +++++++++++++++++++ 118 files changed, 719 insertions(+), 100 deletions(-) create mode 100644 tools/custom-esdoc-plugin.js diff --git a/esdoc.json b/esdoc.json index 4c8fc685af7..9da74a0643e 100644 --- a/esdoc.json +++ b/esdoc.json @@ -5,6 +5,9 @@ "title": "RxJS", "styles": ["./doc/styles/main.css"], "index": "./doc/index.md", + "plugins": [ + {"name": "./tools/custom-esdoc-plugin.js"} + ], "manual": { "asset": "./doc/asset", "overview": [ diff --git a/src/Observable.ts b/src/Observable.ts index a31a6a44695..86ee61d30b2 100644 --- a/src/Observable.ts +++ b/src/Observable.ts @@ -70,10 +70,10 @@ export class Observable implements CoreOperators { /** * @constructor - * @param {Function} subscribe the function that is - * called when the Observable is initially subscribed to. This function is given a Subscriber, to which new values - * can be `next`ed, or an `error` method can be called to raise an error, or `complete` can be called to notify - * of a successful completion. + * @param {Function} subscribe the function that is called when the Observable is + * initially subscribed to. This function is given a Subscriber, to which new values + * can be `next`ed, or an `error` method can be called to raise an error, or + * `complete` can be called to notify of a successful completion. */ constructor(subscribe?: (subscriber: Subscriber) => Subscription | Function | void) { if (subscribe) { @@ -84,22 +84,23 @@ export class Observable implements CoreOperators { // HACK: Since TypeScript inherits static properties too, we have to // fight against TypeScript here so Subject can have a different static create signature /** - * @static + * Creates a new cold Observable by calling the Observable constructor + * @static true + * @owner Observable * @method create * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor - * @returns {Observable} a new cold observable - * @description creates a new cold Observable by calling the Observable constructor + * @return {Observable} a new cold observable */ static create: Function = (subscribe?: (subscriber: Subscriber) => Subscription | Function | void) => { return new Observable(subscribe); }; /** + * Creates a new Observable, with this Observable as the source, and the passed + * operator defined as the new observable's operator. * @method lift * @param {Operator} operator the operator defining the operation to take on the observable - * @returns {Observable} a new observable with the Operator applied - * @description creates a new Observable, with this Observable as the source, and the passed - * operator defined as the new observable's operator. + * @return {Observable} a new observable with the Operator applied */ lift(operator: Operator): Observable { const observable = new Observable(); @@ -109,15 +110,15 @@ export class Observable implements CoreOperators { } /** + * Registers handlers for handling emitted values, error and completions from the observable, and + * executes the observable's subscriber function, which will take action to set up the underlying data stream * @method subscribe * @param {PartialObserver|Function} observerOrNext (optional) either an observer defining all functions to be called, * or the first of three possible handlers, which is the handler for each value emitted from the observable. * @param {Function} error (optional) a handler for a terminal event resulting from an error. If no error handler is provided, * the error will be thrown as unhandled * @param {Function} complete (optional) a handler for a terminal event resulting from successful completion. - * @returns {Subscription} a subscription reference to the registered handlers - * @description registers handlers for handling emitted values, error and completions from the observable, and - * executes the observable's subscriber function, which will take action to set up the underlying data stream + * @return {Subscription} a subscription reference to the registered handlers */ subscribe(observerOrNext?: PartialObserver | ((value: T) => void), error?: (error: any) => void, @@ -147,7 +148,7 @@ export class Observable implements CoreOperators { * @param {Function} next a handler for each value emitted by the observable * @param {any} [thisArg] a `this` context for the `next` handler function * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise - * @returns {Promise} a promise that either resolves on observable completion or + * @return {Promise} a promise that either resolves on observable completion or * rejects with the handled error */ forEach(next: (value: T) => void, thisArg: any, PromiseCtor?: typeof Promise): Promise { @@ -303,9 +304,9 @@ export class Observable implements CoreOperators { zipAll: (project?: (...values: Array) => R) => Observable; /** + * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable * @method Symbol.observable - * @returns {Observable} this instance of the observable - * @description an interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable + * @return {Observable} this instance of the observable */ [SymbolShim.observable]() { return this; diff --git a/src/observable/ArrayObservable.ts b/src/observable/ArrayObservable.ts index 24a7b08af46..32248bf8da3 100644 --- a/src/observable/ArrayObservable.ts +++ b/src/observable/ArrayObservable.ts @@ -6,12 +6,30 @@ import {Subscriber} from '../Subscriber'; import {isScheduler} from '../util/isScheduler'; import {Subscription} from '../Subscription'; +/** + * + */ export class ArrayObservable extends Observable { + /** + * @param array + * @param scheduler + * @return {ArrayObservable} + * @static true + * @name fromArray + * @owner Observable + */ static create(array: T[], scheduler?: Scheduler) { return new ArrayObservable(array, scheduler); } + /** + * @param array + * @return {any} + * @static true + * @name of + * @owner Observable + */ static of(...array: Array): Observable { let scheduler = array[array.length - 1]; if (isScheduler(scheduler)) { diff --git a/src/observable/BoundCallbackObservable.ts b/src/observable/BoundCallbackObservable.ts index 034e1d4bcc6..b5a3d5b4b68 100644 --- a/src/observable/BoundCallbackObservable.ts +++ b/src/observable/BoundCallbackObservable.ts @@ -6,6 +6,9 @@ import {tryCatch} from '../util/tryCatch'; import {errorObject} from '../util/errorObject'; import {AsyncSubject} from '../subject/AsyncSubject'; +/** + * + */ export class BoundCallbackObservable extends Observable { subject: AsyncSubject; @@ -27,6 +30,21 @@ export class BoundCallbackObservable extends Observable { static create(callbackFunc: Function, selector?: void, scheduler?: Scheduler): (...args: any[]) => Observable; static create(callbackFunc: Function, selector?: (...args: any[]) => T, scheduler?: Scheduler): (...args: any[]) => Observable; /* tslint:enable:max-line-length */ + + /** + * Converts a callback function to an observable sequence. + * @param {function} callbackFunc Function with a callback as the last + * parameter. + * @param {function} selector A selector which takes the arguments from the + * callback to produce a single item to yield on next. + * @param {Scheduler} [scheduler] The scheduler on which to schedule + * the callbacks. + * @return {function(...params: *): Observable} a function which returns the + * Observable that corresponds to the callback. + * @static true + * @name bindCallback + * @owner Observable + */ static create(callbackFunc: Function, selector: Function | void = undefined, scheduler?: Scheduler): (...args: any[]) => Observable { diff --git a/src/observable/BoundNodeCallbackObservable.ts b/src/observable/BoundNodeCallbackObservable.ts index 6512d72e9cd..39ba22bb77f 100644 --- a/src/observable/BoundNodeCallbackObservable.ts +++ b/src/observable/BoundNodeCallbackObservable.ts @@ -6,6 +6,9 @@ import {tryCatch} from '../util/tryCatch'; import {errorObject} from '../util/errorObject'; import {AsyncSubject} from '../subject/AsyncSubject'; +/** + * + */ export class BoundNodeCallbackObservable extends Observable { subject: AsyncSubject; @@ -20,6 +23,17 @@ export class BoundNodeCallbackObservable extends Observable { static create(callbackFunc: Function, selector?: void, scheduler?: Scheduler): (...args: any[]) => Observable; static create(callbackFunc: Function, selector?: (...args: any[]) => T, scheduler?: Scheduler): (...args: any[]) => Observable; /* tslint:enable:max-line-length */ + + /** + * Converts a node callback to an Observable. + * @param callbackFunc + * @param selector + * @param scheduler + * @return {function(...params: *): Observable} + * @static true + * @name bindNodeCallback + * @owner Observable + */ static create(callbackFunc: Function, selector: Function | void = undefined, scheduler?: Scheduler): Function { diff --git a/src/observable/DeferObservable.ts b/src/observable/DeferObservable.ts index d6a527a0015..cebc5954999 100644 --- a/src/observable/DeferObservable.ts +++ b/src/observable/DeferObservable.ts @@ -3,8 +3,18 @@ import {Subscriber} from '../Subscriber'; import {tryCatch} from '../util/tryCatch'; import {errorObject} from '../util/errorObject'; +/** + * + */ export class DeferObservable extends Observable { + /** + * @param observableFactory + * @return {DeferObservable} + * @static true + * @name defer + * @owner Observable + */ static create(observableFactory: () => Observable): Observable { return new DeferObservable(observableFactory); } diff --git a/src/observable/EmptyObservable.ts b/src/observable/EmptyObservable.ts index ab6b633f750..160f1f84249 100644 --- a/src/observable/EmptyObservable.ts +++ b/src/observable/EmptyObservable.ts @@ -3,8 +3,18 @@ import {Subscriber} from '../Subscriber'; import {Observable} from '../Observable'; import {Subscription} from '../Subscription'; +/** + * + */ export class EmptyObservable extends Observable { + /** + * @param scheduler + * @return {EmptyObservable} + * @static true + * @name empty + * @owner Observable + */ static create(scheduler?: Scheduler): Observable { return new EmptyObservable(scheduler); } diff --git a/src/observable/ErrorObservable.ts b/src/observable/ErrorObservable.ts index d3e04dacc07..43663fb99bc 100644 --- a/src/observable/ErrorObservable.ts +++ b/src/observable/ErrorObservable.ts @@ -2,8 +2,19 @@ import {Scheduler} from '../Scheduler'; import {Observable} from '../Observable'; import {Subscription} from '../Subscription'; +/** + * + */ export class ErrorObservable extends Observable { + /** + * @param error + * @param scheduler + * @return {ErrorObservable} + * @static true + * @name throw + * @owner Observable + */ static create(error: any, scheduler?: Scheduler) { return new ErrorObservable(error, scheduler); } diff --git a/src/observable/ForkJoinObservable.ts b/src/observable/ForkJoinObservable.ts index a9df73b3070..db98c3f1005 100644 --- a/src/observable/ForkJoinObservable.ts +++ b/src/observable/ForkJoinObservable.ts @@ -5,12 +5,22 @@ import {EmptyObservable} from './EmptyObservable'; import {isPromise} from '../util/isPromise'; import {isArray} from '../util/isArray'; +/** + * + */ export class ForkJoinObservable extends Observable { constructor(private sources: Array | Promise>, private resultSelector?: (...values: Array) => T) { super(); } + /** + * @param sources + * @return {any} + * @static true + * @name forkJoin + * @owner Observable + */ static create(...sources: Array | Promise | Array> | ((...values: Array) => any)>): Observable { diff --git a/src/observable/FromEventObservable.ts b/src/observable/FromEventObservable.ts index e0191f9cfb3..50d8175c927 100644 --- a/src/observable/FromEventObservable.ts +++ b/src/observable/FromEventObservable.ts @@ -34,8 +34,20 @@ function isEventTarget(sourceObj: any): sourceObj is EventTarget { export type EventTargetLike = EventTarget | NodeStyleEventEmmitter | JQueryStyleEventEmitter | NodeList | HTMLCollection; +/** + * + */ export class FromEventObservable extends Observable { + /** + * @param sourceObj + * @param eventName + * @param selector + * @return {FromEventObservable} + * @static true + * @name fromEvent + * @owner Observable + */ static create(sourceObj: EventTargetLike, eventName: string, selector?: (...args: Array) => T): Observable { return new FromEventObservable(sourceObj, eventName, selector); } diff --git a/src/observable/FromEventPatternObservable.ts b/src/observable/FromEventPatternObservable.ts index 2a47ad5b2a2..20f70d8beac 100644 --- a/src/observable/FromEventPatternObservable.ts +++ b/src/observable/FromEventPatternObservable.ts @@ -4,8 +4,20 @@ import {tryCatch} from '../util/tryCatch'; import {errorObject} from '../util/errorObject'; import {Subscriber} from '../Subscriber'; +/** + * + */ export class FromEventPatternObservable extends Observable { + /** + * @param addHandler + * @param removeHandler + * @param selector + * @return {FromEventPatternObservable} + * @static true + * @name fromEventPattern + * @owner Observable + */ static create(addHandler: (handler: Function) => any, removeHandler: (handler: Function) => void, selector?: (...args: Array) => T) { diff --git a/src/observable/FromObservable.ts b/src/observable/FromObservable.ts index ef54497e6d9..3323cba105b 100644 --- a/src/observable/FromObservable.ts +++ b/src/observable/FromObservable.ts @@ -15,11 +15,24 @@ import {ObserveOnSubscriber} from '../operator/observeOn'; const isArrayLike = ((x: any): x is ArrayLike => x && typeof x.length === 'number'); +/** + * + */ export class FromObservable extends Observable { constructor(private ish: Observable | Promise | Iterator | ArrayLike, private scheduler: Scheduler) { super(null); } + /** + * @param ish + * @param mapFnOrScheduler + * @param thisArg + * @param lastScheduler + * @return {any} + * @static true + * @name from + * @owner Observable + */ static create(ish: any, mapFnOrScheduler?: Scheduler | ((x: any, y: number) => T), thisArg?: any, lastScheduler?: Scheduler): Observable { let scheduler: Scheduler = null; let mapFn: (x: number, y: any) => T = null; diff --git a/src/observable/IntervalObservable.ts b/src/observable/IntervalObservable.ts index df7ccebe36e..1238418b580 100644 --- a/src/observable/IntervalObservable.ts +++ b/src/observable/IntervalObservable.ts @@ -4,7 +4,18 @@ import {Scheduler} from '../Scheduler'; import {Observable} from '../Observable'; import {asap} from '../scheduler/asap'; +/** + * + */ export class IntervalObservable extends Observable { + /** + * @param period + * @param scheduler + * @return {IntervalObservable} + * @static true + * @name interval + * @owner Observable + */ static create(period: number = 0, scheduler: Scheduler = asap): Observable { return new IntervalObservable(period, scheduler); } diff --git a/src/observable/NeverObservable.ts b/src/observable/NeverObservable.ts index c69e435d3bb..373f6749b8d 100644 --- a/src/observable/NeverObservable.ts +++ b/src/observable/NeverObservable.ts @@ -2,7 +2,16 @@ import {Observable} from '../Observable'; import {Subscriber} from '../Subscriber'; import {noop} from '../util/noop'; +/** + * + */ export class NeverObservable extends Observable { + /** + * @return {NeverObservable} + * @static true + * @name never + * @owner Observable + */ static create() { return new NeverObservable(); } diff --git a/src/observable/PromiseObservable.ts b/src/observable/PromiseObservable.ts index f94142e9cfa..d7a6ed4c0a4 100644 --- a/src/observable/PromiseObservable.ts +++ b/src/observable/PromiseObservable.ts @@ -4,10 +4,21 @@ import {Observable} from '../Observable'; import {Subscriber} from '../Subscriber'; import {Subscription} from '../Subscription'; +/** + * + */ export class PromiseObservable extends Observable { public value: T; + /** + * @param promise + * @param scheduler + * @return {PromiseObservable} + * @static true + * @name fromPromise + * @owner Observable + */ static create(promise: Promise, scheduler: Scheduler = null): Observable { return new PromiseObservable(promise, scheduler); } diff --git a/src/observable/RangeObservable.ts b/src/observable/RangeObservable.ts index df9578768e4..05919fa23e9 100644 --- a/src/observable/RangeObservable.ts +++ b/src/observable/RangeObservable.ts @@ -3,8 +3,20 @@ import {Observable} from '../Observable'; import {Subscription} from '../Subscription'; import {Subscriber} from '../Subscriber'; +/** + * + */ export class RangeObservable extends Observable { + /** + * @param start + * @param end + * @param scheduler + * @return {RangeObservable} + * @static true + * @name range + * @owner Observable + */ static create(start: number = 0, end: number = 0, scheduler?: Scheduler): Observable { return new RangeObservable(start, end, scheduler); } diff --git a/src/observable/TimerObservable.ts b/src/observable/TimerObservable.ts index 758c05e9022..438b4acadd4 100644 --- a/src/observable/TimerObservable.ts +++ b/src/observable/TimerObservable.ts @@ -7,8 +7,20 @@ import {isDate} from '../util/isDate'; import {Subscription} from '../Subscription'; import {Subscriber} from '../Subscriber'; +/** + * + */ export class TimerObservable extends Observable { + /** + * @param dueTime + * @param period + * @param scheduler + * @return {TimerObservable} + * @static true + * @name timer + * @owner Observable + */ static create(dueTime: number | Date = 0, period?: number | Scheduler, scheduler?: Scheduler): Observable { return new TimerObservable(dueTime, period, scheduler); } diff --git a/src/observable/dom/AjaxObservable.ts b/src/observable/dom/AjaxObservable.ts index 554be7acb95..fab81d527f5 100644 --- a/src/observable/dom/AjaxObservable.ts +++ b/src/observable/dom/AjaxObservable.ts @@ -90,7 +90,7 @@ export function ajaxGetJSON(url: string, resultSelector?: (data: T) => R, * - crossDomain: true if a cross domain request, else false * - createXHR: a function to override if you need to use an alternate XMLHttpRequest implementation. * - resultSelector: a function to use to alter the output value type of the Observable. Gets {AjaxResponse} as an argument - * @returns {Observable} An observable sequence containing the XMLHttpRequest. + * @return {Observable} An observable sequence containing the XMLHttpRequest. */ export class AjaxObservable extends Observable { static create: AjaxCreationMethod = (() => { diff --git a/src/observable/dom/WebSocketSubject.ts b/src/observable/dom/WebSocketSubject.ts index 5806b86fc04..7f602cee3f7 100644 --- a/src/observable/dom/WebSocketSubject.ts +++ b/src/observable/dom/WebSocketSubject.ts @@ -20,6 +20,9 @@ export interface WebSocketSubjectConfig { WebSocketCtor?: { new(url: string, protocol?: string|Array): WebSocket }; } +/** + * + */ export class WebSocketSubject extends Subject { url: string; protocol: string|Array; @@ -33,6 +36,13 @@ export class WebSocketSubject extends Subject { return JSON.parse(e.data); } + /** + * @param urlConfigOrSource + * @return {WebSocketSubject} + * @static true + * @name webSocket + * @owner Observable + */ static create(urlConfigOrSource: string | WebSocketSubjectConfig): WebSocketSubject { return new WebSocketSubject(urlConfigOrSource); } diff --git a/src/operator/buffer.ts b/src/operator/buffer.ts index ecfbba44d2c..aca81c1ec1e 100644 --- a/src/operator/buffer.ts +++ b/src/operator/buffer.ts @@ -16,8 +16,10 @@ import {subscribeToResult} from '../util/subscribeToResult'; * * @param {Observable} closingNotifier an Observable that signals the * buffer to be emitted} from the returned observable. - * @returns {Observable} an Observable of buffers, which are arrays of + * @return {Observable} an Observable of buffers, which are arrays of * values. + * @method buffer + * @owner Observable */ export function buffer(closingNotifier: Observable): Observable { return this.lift(new BufferOperator(closingNotifier)); diff --git a/src/operator/bufferCount.ts b/src/operator/bufferCount.ts index 425ac3e22f0..54fe90107c4 100644 --- a/src/operator/bufferCount.ts +++ b/src/operator/bufferCount.ts @@ -16,7 +16,9 @@ import {Observable} from '../Observable'; * buffer. (e.g. if `startBufferEvery` is `2`, then a new buffer will be started * on every other value from the source.) A new buffer is started at the * beginning of the source by default. - * @returns {Observable} an Observable of arrays of buffered values. + * @return {Observable} an Observable of arrays of buffered values. + * @method bufferCount + * @owner Observable */ export function bufferCount(bufferSize: number, startBufferEvery: number = null): Observable { return this.lift(new BufferCountOperator(bufferSize, startBufferEvery)); diff --git a/src/operator/bufferTime.ts b/src/operator/bufferTime.ts index f18bf385716..b0baaec92c0 100644 --- a/src/operator/bufferTime.ts +++ b/src/operator/bufferTime.ts @@ -18,7 +18,9 @@ import {asap} from '../scheduler/asap'; * @param {Scheduler} [scheduler] (optional, defaults to `asap` scheduler) The * scheduler on which to schedule the intervals that determine buffer * boundaries. - * @returns {Observable} an observable of arrays of buffered values. + * @return {Observable} an observable of arrays of buffered values. + * @method bufferTime + * @owner Observable */ export function bufferTime(bufferTimeSpan: number, bufferCreationInterval: number = null, diff --git a/src/operator/bufferToggle.ts b/src/operator/bufferToggle.ts index de958a261c1..55328b736c8 100644 --- a/src/operator/bufferToggle.ts +++ b/src/operator/bufferToggle.ts @@ -17,7 +17,9 @@ import {errorObject} from '../util/errorObject'; * @param {Function} closingSelector a function that takes the value emitted by * the `openings` observable and returns an Observable, which, when it emits, * signals that the associated buffer should be emitted and cleared. - * @returns {Observable} an observable of arrays of buffered values. + * @return {Observable} an observable of arrays of buffered values. + * @method bufferToggle + * @owner Observable */ export function bufferToggle(openings: Observable, closingSelector: (value: O) => Observable): Observable { diff --git a/src/operator/bufferWhen.ts b/src/operator/bufferWhen.ts index 9c1b7d31f14..b711bf02594 100644 --- a/src/operator/bufferWhen.ts +++ b/src/operator/bufferWhen.ts @@ -18,7 +18,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * * @param {function} closingSelector a function that takes no arguments and * returns an Observable that signals buffer closure. - * @returns {Observable} an observable of arrays of buffered values. + * @return {Observable} an observable of arrays of buffered values. + * @method bufferWhen + * @owner Observable */ export function bufferWhen(closingSelector: () => Observable): Observable { return this.lift(new BufferWhenOperator(closingSelector)); diff --git a/src/operator/cache.ts b/src/operator/cache.ts index 9ef1a03cbf3..1789b08d754 100644 --- a/src/operator/cache.ts +++ b/src/operator/cache.ts @@ -3,6 +3,14 @@ import {publishReplay} from './publishReplay'; import {Scheduler} from '../Scheduler'; import {ConnectableObservable} from '../observable/ConnectableObservable'; +/** + * @param bufferSize + * @param windowTime + * @param scheduler + * @return {Observable} + * @method cache + * @owner Observable + */ export function cache(bufferSize: number = Number.POSITIVE_INFINITY, windowTime: number = Number.POSITIVE_INFINITY, scheduler?: Scheduler): Observable { diff --git a/src/operator/catch.ts b/src/operator/catch.ts index e54dd3b9110..1aeacee29b0 100644 --- a/src/operator/catch.ts +++ b/src/operator/catch.ts @@ -9,6 +9,8 @@ import {Observable} from '../Observable'; * is returned by the `selector` will be used to continue the observable chain. * @return {Observable} an observable that originates from either the source or the observable returned by the * catch `selector` function. + * @method catch + * @owner Observable */ export function _catch(selector: (err: any, caught: Observable) => Observable): Observable { const operator = new CatchOperator(selector); diff --git a/src/operator/combineAll.ts b/src/operator/combineAll.ts index 3dd1adfae90..8de8178d1c9 100644 --- a/src/operator/combineAll.ts +++ b/src/operator/combineAll.ts @@ -11,7 +11,9 @@ import {Observable} from '../Observable'; * - if there is no `project` function, an array of all of the most recent values is emitted by the returned observable. * @param {function} [project] an optional function to map the most recent values from each observable into a new result. Takes each of the * most recent values from each collected observable as arguments, in order. - * @returns {Observable} an observable of projected results or arrays of recent values. + * @return {Observable} an observable of projected results or arrays of recent values. + * @method combineAll + * @owner Observable */ export function combineAll(project?: (...values: Array) => R): Observable { return this.lift(new CombineLatestOperator(project)); diff --git a/src/operator/combineLatest.ts b/src/operator/combineLatest.ts index 12c014b11fa..880459ebc9f 100644 --- a/src/operator/combineLatest.ts +++ b/src/operator/combineLatest.ts @@ -16,8 +16,10 @@ import {subscribeToResult} from '../util/subscribeToResult'; * value of that, or just emitting the array of recent values directly if there is no `project` function. * @param {...Observable} observables the observables to combine the source with * @param {function} [project] an optional function to project the values from the combined recent values into a new value for emission. - * @returns {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of + * @return {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of * the most recent values from each observable. + * @method combineLatest + * @owner Observable */ export function combineLatest(...observables: Array | Array> | @@ -59,16 +61,6 @@ export interface CombineLatestSignature { } /* tslint:enable:max-line-length */ -/** - * Combines the values from observables passed as arguments. This is done by subscribing - * to each observable, in order, and collecting an array of each of the most recent values any time any of the observables - * emits, then either taking that array and passing it as arguments to an option `project` function and emitting the return - * value of that, or just emitting the array of recent values directly if there is no `project` function. - * @param {...Observable} observables the observables to combine - * @param {function} [project] an optional function to project the values from the combined recent values into a new value for emission. - * @returns {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of - * the most recent values from each observable. - */ /* tslint:disable:max-line-length */ export function combineLatestStatic(v1: ObservableInput, scheduler?: Scheduler): Observable<[T]>; export function combineLatestStatic(v1: ObservableInput, v2: ObservableInput, scheduler?: Scheduler): Observable<[T, T2]>; @@ -86,6 +78,20 @@ export function combineLatestStatic(...observables: Array(array: ObservableInput[], scheduler?: Scheduler): Observable; export function combineLatestStatic(array: ObservableInput[], project: (...values: Array) => R, scheduler?: Scheduler): Observable; /* tslint:enable:max-line-length */ + +/** + * Combines the values from observables passed as arguments. This is done by subscribing + * to each observable, in order, and collecting an array of each of the most recent values any time any of the observables + * emits, then either taking that array and passing it as arguments to an option `project` function and emitting the return + * value of that, or just emitting the array of recent values directly if there is no `project` function. + * @param {...Observable} observables the observables to combine + * @param {function} [project] an optional function to project the values from the combined recent values into a new value for emission. + * @return {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of + * the most recent values from each observable. + * @static true + * @name combineLatest + * @owner Observable + */ export function combineLatestStatic(...observables: Array | Array> | (((...values: Array) => R)) | diff --git a/src/operator/concat.ts b/src/operator/concat.ts index e4594c9c56c..59aec2e8a0e 100644 --- a/src/operator/concat.ts +++ b/src/operator/concat.ts @@ -10,7 +10,9 @@ import {MergeAllOperator} from './mergeAll'; * on to the next. * @params {...Observable} the observables to concatenate * @params {Scheduler} [scheduler] an optional scheduler to schedule each observable subscription on. - * @returns {Observable} All values of each passed observable merged into a single observable, in order, in serial fashion. + * @return {Observable} All values of each passed observable merged into a single observable, in order, in serial fashion. + * @method concat + * @owner Observable */ export function concat(...observables: Array | Scheduler>): Observable { return concatStatic(this, ...observables); @@ -21,7 +23,10 @@ export function concat(...observables: Array | Scheduler>) * into the returned observable. Will wait for each observable to complete before moving on to the next. * @params {...Observable} the observables to concatenate * @params {Scheduler} [scheduler] an optional scheduler to schedule each observable subscription on. - * @returns {Observable} All values of each passed observable merged into a single observable, in order, in serial fashion. + * @return {Observable} All values of each passed observable merged into a single observable, in order, in serial fashion. + * @static true + * @name concat + * @owner Observable */ export function concatStatic(...observables: Array | Scheduler>): Observable { let scheduler: Scheduler = null; diff --git a/src/operator/concatAll.ts b/src/operator/concatAll.ts index 1f5eb64cbbd..6edf2831178 100644 --- a/src/operator/concatAll.ts +++ b/src/operator/concatAll.ts @@ -9,7 +9,9 @@ import {MergeAllOperator} from './mergeAll'; * Observables it emits generally complete slower than the source emits, you can run into * memory issues as the incoming observables collect in an unbounded buffer. * - * @returns {Observable} an observable of values merged from the incoming observables. + * @return {Observable} an observable of values merged from the incoming observables. + * @method concatAll + * @owner Observable */ export function concatAll(): T { return this.lift(new MergeAllOperator(1)); diff --git a/src/operator/concatMap.ts b/src/operator/concatMap.ts index 2dfcf02adfe..2fecad941ac 100644 --- a/src/operator/concatMap.ts +++ b/src/operator/concatMap.ts @@ -17,8 +17,10 @@ import {Observable} from '../Observable'; * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable - * @returns {Observable} an observable of values merged from the projected Observables as they were subscribed to, + * @return {Observable} an observable of values merged from the projected Observables as they were subscribed to, * one at a time. Optionally, these values may have been projected from a passed `projectResult` argument. + * @method concatMap + * @owner Observable */ export function concatMap(project: (value: T, index: number) => Observable, resultSelector?: (outerValue: T, innerValue: R, outerIndex: number, innerIndex: number) => R2) { diff --git a/src/operator/concatMapTo.ts b/src/operator/concatMapTo.ts index c702064dea1..16148e5a7cb 100644 --- a/src/operator/concatMapTo.ts +++ b/src/operator/concatMapTo.ts @@ -11,8 +11,10 @@ import {MergeMapToOperator} from './mergeMapTo'; * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable - * @returns {Observable} an observable of values merged together by joining the passed observable + * @return {Observable} an observable of values merged together by joining the passed observable * with itself, one after the other, for each value emitted from the source. + * @method concatMapTo + * @owner Observable */ export function concatMapTo(observable: Observable, resultSelector?: ( diff --git a/src/operator/count.ts b/src/operator/count.ts index 12bba0ef198..0010854b9a7 100644 --- a/src/operator/count.ts +++ b/src/operator/count.ts @@ -13,8 +13,10 @@ import {Subscriber} from '../Subscriber'; * - `value`: the value from the source observable * - `index`: the "index" of the value from the source observable * - `source`: the source observable instance itself. - * @returns {Observable} an observable of one number that represents the count as described + * @return {Observable} an observable of one number that represents the count as described * above + * @method count + * @owner Observable */ export function count(predicate?: (value: T, index: number, source: Observable) => boolean): Observable { return this.lift(new CountOperator(predicate, this)); diff --git a/src/operator/debounce.ts b/src/operator/debounce.ts index 21ef20a97a6..777c3946491 100644 --- a/src/operator/debounce.ts +++ b/src/operator/debounce.ts @@ -15,7 +15,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * latest item, waits for a silence as long as the `durationSelector` specifies, * and only then emits the latest source item on the result Observable. * @param {function} durationSelector function for computing the timeout duration for each item. - * @returns {Observable} an Observable the same as source Observable, but drops items. + * @return {Observable} an Observable the same as source Observable, but drops items. + * @method debounce + * @owner Observable */ export function debounce(durationSelector: (value: T) => Observable | Promise): Observable { return this.lift(new DebounceOperator(durationSelector)); diff --git a/src/operator/debounceTime.ts b/src/operator/debounceTime.ts index 4d03447e618..98f9c2f601a 100644 --- a/src/operator/debounceTime.ts +++ b/src/operator/debounceTime.ts @@ -15,7 +15,9 @@ import {asap} from '../scheduler/asap'; * Optionally takes a scheduler for manging timers. * @param {number} dueTime the timeout value for the window of time required to not drop the item. * @param {Scheduler} [scheduler] the Scheduler to use for managing the timers that handle the timeout for each item. - * @returns {Observable} an Observable the same as source Observable, but drops items. + * @return {Observable} an Observable the same as source Observable, but drops items. + * @method debounceTime + * @owner Observable */ export function debounceTime(dueTime: number, scheduler: Scheduler = asap): Observable { return this.lift(new DebounceTimeOperator(dueTime, scheduler)); diff --git a/src/operator/defaultIfEmpty.ts b/src/operator/defaultIfEmpty.ts index d64ef9a4dc0..8e0fa48e8e9 100644 --- a/src/operator/defaultIfEmpty.ts +++ b/src/operator/defaultIfEmpty.ts @@ -5,7 +5,9 @@ import {Subscriber} from '../Subscriber'; /** * Returns an Observable that emits the elements of the source or a specified default value if empty. * @param {any} defaultValue the default value used if source is empty; defaults to null. - * @returns {Observable} an Observable of the items emitted by the where empty values are replaced by the specified default value or null. + * @return {Observable} an Observable of the items emitted by the where empty values are replaced by the specified default value or null. + * @method defaultIfEmpty + * @owner Observable */ export function defaultIfEmpty(defaultValue: R = null): Observable { return this.lift(new DefaultIfEmptyOperator(defaultValue)); diff --git a/src/operator/delay.ts b/src/operator/delay.ts index f462165ec32..58090cee65a 100644 --- a/src/operator/delay.ts +++ b/src/operator/delay.ts @@ -11,7 +11,9 @@ import {Observable} from '../Observable'; * by a given timeout or until a given Date. * @param {number|Date} delay the timeout value or date until which the emission of the source items is delayed. * @param {Scheduler} [scheduler] the Scheduler to use for managing the timers that handle the timeout for each item. - * @returns {Observable} an Observable that delays the emissions of the source Observable by the specified timeout or Date. + * @return {Observable} an Observable that delays the emissions of the source Observable by the specified timeout or Date. + * @method delay + * @owner Observable */ export function delay(delay: number|Date, scheduler: Scheduler = asap): Observable { diff --git a/src/operator/delayWhen.ts b/src/operator/delayWhen.ts index 11ad54f79aa..3fee9f43109 100644 --- a/src/operator/delayWhen.ts +++ b/src/operator/delayWhen.ts @@ -12,7 +12,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * by a subscription delay and a delay selector function for each element. * @param {Function} selector function to retrieve a sequence indicating the delay for each given element. * @param {Observable} sequence indicating the delay for the subscription to the source. - * @returns {Observable} an Observable that delays the emissions of the source Observable by the specified timeout or Date. + * @return {Observable} an Observable that delays the emissions of the source Observable by the specified timeout or Date. + * @method delayWhen + * @owner Observable */ export function delayWhen(delayDurationSelector: (value: T) => Observable, diff --git a/src/operator/dematerialize.ts b/src/operator/dematerialize.ts index fab25f365b6..9719ae09704 100644 --- a/src/operator/dematerialize.ts +++ b/src/operator/dematerialize.ts @@ -5,7 +5,9 @@ import {Notification} from '../Notification'; /** * Returns an Observable that transforms Notification objects into the items or notifications they represent. - * @returns {Observable} an Observable that emits items and notifications embedded in Notification objects emitted by the source Observable. + * @return {Observable} an Observable that emits items and notifications embedded in Notification objects emitted by the source Observable. + * @method dematerialize + * @owner Observable */ export function dematerialize(): Observable { return this.lift(new DeMaterializeOperator()); diff --git a/src/operator/distinct.ts b/src/operator/distinct.ts index 80255d8f649..e1a3ed5dceb 100644 --- a/src/operator/distinct.ts +++ b/src/operator/distinct.ts @@ -14,7 +14,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * An optional parameter is also provided such that an Observable can be provided to queue the internal HashSet to flush the values it holds. * @param {function} [compare] optional comparison function called to test if an item is distinct from previous items in the source. * @param {Observable} [flushes] optional Observable for flushing the internal HashSet of the operator. - * @returns {Observable} an Observable that emits items from the source Observable with distinct values. + * @return {Observable} an Observable that emits items from the source Observable with distinct values. + * @method distinct + * @owner Observable */ export function distinct(compare?: (x: T, y: T) => boolean, flushes?: Observable): Observable { return this.lift(new DistinctOperator(compare, flushes)); diff --git a/src/operator/distinctKey.ts b/src/operator/distinctKey.ts index de2962867d5..af48582893a 100644 --- a/src/operator/distinctKey.ts +++ b/src/operator/distinctKey.ts @@ -11,7 +11,9 @@ import {Observable} from '../Observable'; * @param {string} key string key for object property lookup on each item. * @param {function} [compare] optional comparison function called to test if an item is distinct from previous items in the source. * @param {Observable} [flushes] optional Observable for flushing the internal HashSet of the operator. - * @returns {Observable} an Observable that emits items from the source Observable with distinct values. + * @return {Observable} an Observable that emits items from the source Observable with distinct values. + * @method distinctKey + * @owner Observable */ export function distinctKey(key: string, compare?: (x: T, y: T) => boolean, flushes?: Observable): Observable { return distinct.call(this, function(x: T, y: T) { diff --git a/src/operator/distinctUntilChanged.ts b/src/operator/distinctUntilChanged.ts index 87536df10b7..dbf65e51095 100644 --- a/src/operator/distinctUntilChanged.ts +++ b/src/operator/distinctUntilChanged.ts @@ -9,7 +9,9 @@ import {Observable} from '../Observable'; * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. * If a comparator function is not provided, an equality check is used by default. * @param {function} [compare] optional comparison function called to test if an item is distinct from the previous item in the source. - * @returns {Observable} an Observable that emits items from the source Observable with distinct values. + * @return {Observable} an Observable that emits items from the source Observable with distinct values. + * @method distinctUntilChanged + * @owner Observable */ export function distinctUntilChanged(compare?: (x: T, y: T) => boolean): Observable; export function distinctUntilChanged(compare: (x: K, y: K) => boolean, keySelector?: (x: T) => K): Observable; diff --git a/src/operator/distinctUntilKeyChanged.ts b/src/operator/distinctUntilKeyChanged.ts index f8e95d0d49f..98fde31a76d 100644 --- a/src/operator/distinctUntilKeyChanged.ts +++ b/src/operator/distinctUntilKeyChanged.ts @@ -8,7 +8,9 @@ import {Observable} from '../Observable'; * If a comparator function is not provided, an equality check is used by default. * @param {string} key string key for object property lookup on each item. * @param {function} [compare] optional comparison function called to test if an item is distinct from the previous item in the source. - * @returns {Observable} an Observable that emits items from the source Observable with distinct values based on the key specified. + * @return {Observable} an Observable that emits items from the source Observable with distinct values based on the key specified. + * @method distinctUntilKeyChanged + * @owner Observable */ export function distinctUntilKeyChanged(key: string, compare?: (x: T, y: T) => boolean): Observable { return distinctUntilChanged.call(this, function(x: T, y: T) { diff --git a/src/operator/do.ts b/src/operator/do.ts index f06a09c7059..a2e95b90a10 100644 --- a/src/operator/do.ts +++ b/src/operator/do.ts @@ -11,6 +11,8 @@ import {PartialObserver} from '../Observer'; * @param {function} [error] callback for errors in the source. * @param {function} [complete] callback for the completion of the source. * @reurns {Observable} a mirrored Observable with the specified Observer or callback attached for each item. + * @method do + * @owner Observable */ export function _do(nextOrObserver?: PartialObserver | ((x: T) => void), error?: (e: any) => void, diff --git a/src/operator/elementAt.ts b/src/operator/elementAt.ts index 84a2968b507..c1ec17a7dd2 100644 --- a/src/operator/elementAt.ts +++ b/src/operator/elementAt.ts @@ -8,7 +8,9 @@ import {Observable} from '../Observable'; * If default is given, missing indices will output this value on next; otherwise, outputs error. * @param {number} index the index of the value to be retrieved. * @param {any} [defaultValue] the default value returned for missing indices. - * @returns {Observable} an Observable that emits a single item, if it is found. Otherwise, will emit the default value if given. + * @return {Observable} an Observable that emits a single item, if it is found. Otherwise, will emit the default value if given. + * @method elementAt + * @owner Observable */ export function elementAt(index: number, defaultValue?: T): Observable { return this.lift(new ElementAtOperator(index, defaultValue)); diff --git a/src/operator/every.ts b/src/operator/every.ts index 7d28eee5779..9ef68929cb1 100644 --- a/src/operator/every.ts +++ b/src/operator/every.ts @@ -7,7 +7,9 @@ import {Subscriber} from '../Subscriber'; * Returns an Observable that emits whether or not every item of the source satisfies the condition specified. * @param {function} predicate a function for determining if an item meets a specified condition. * @param {any} [thisArg] optional object to use for `this` in the callback - * @returns {Observable} an Observable of booleans that determines if all items of the source Observable meet the condition specified. + * @return {Observable} an Observable of booleans that determines if all items of the source Observable meet the condition specified. + * @method every + * @owner Observable */ export function every(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable { diff --git a/src/operator/exhaust.ts b/src/operator/exhaust.ts index 070a135decb..902398d0cea 100644 --- a/src/operator/exhaust.ts +++ b/src/operator/exhaust.ts @@ -10,7 +10,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * until it completes before subscribing to the next. * Items that come in before the first has exhausted will be dropped. * Similar to `concatAll`, but will not hold on to items that come in before the first is exhausted. - * @returns {Observable} an Observable which contains all of the items of the first Observable and following Observables in the source. + * @return {Observable} an Observable which contains all of the items of the first Observable and following Observables in the source. + * @method exhaust + * @owner Observable */ export function exhaust(): Observable { return this.lift(new SwitchFirstOperator()); diff --git a/src/operator/exhaustMap.ts b/src/operator/exhaustMap.ts index b6dbc09ebd5..6ab078f821b 100644 --- a/src/operator/exhaustMap.ts +++ b/src/operator/exhaustMap.ts @@ -10,7 +10,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * to create a new Observable, which are then concatenated together to produce a new Observable. * @param {function} project function called for each item of the source to produce a new Observable. * @param {function} [resultSelector] optional function for then selecting on each inner Observable. - * @returns {Observable} an Observable containing all the projected Observables of each item of the source concatenated together. + * @return {Observable} an Observable containing all the projected Observables of each item of the source concatenated together. + * @method exhaustMap + * @owner Observable */ export function exhaustMap(project: (value: T, index: number) => Observable, resultSelector?: ( diff --git a/src/operator/expand.ts b/src/operator/expand.ts index 1575f2c6fa5..eadfcdb9010 100644 --- a/src/operator/expand.ts +++ b/src/operator/expand.ts @@ -15,7 +15,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * @param {function} project the function for projecting the next emitted item of the Observable. * @param {number} [concurrent] the max number of observables that can be created concurrently. defaults to infinity. * @param {Scheduler} [scheduler] The Scheduler to use for managing the expansions. - * @returns {Observable} an Observable containing the expansions of the source Observable. + * @return {Observable} an Observable containing the expansions of the source Observable. + * @method expand + * @owner Observable */ export function expand(project: (value: T, index: number) => Observable, concurrent: number = Number.POSITIVE_INFINITY, diff --git a/src/operator/filter.ts b/src/operator/filter.ts index 011a47cfb57..b4acd39ed8b 100644 --- a/src/operator/filter.ts +++ b/src/operator/filter.ts @@ -9,7 +9,9 @@ import {Observable} from '../Observable'; * @param {Function} select a function that is used to select the resulting values * if it returns `true`, the value is emitted, if `false` the value is not passed to the resulting observable * @param {any} [thisArg] an optional argument to determine the value of `this` in the `select` function - * @returns {Observable} an observable of values allowed by the select function + * @return {Observable} an observable of values allowed by the select function + * @method filter + * @owner Observable */ export function filter(select: (value: T, index: number) => boolean, thisArg?: any): Observable { return this.lift(new FilterOperator(select, thisArg)); diff --git a/src/operator/finally.ts b/src/operator/finally.ts index 8d4ee5d04af..572618dad66 100644 --- a/src/operator/finally.ts +++ b/src/operator/finally.ts @@ -7,7 +7,9 @@ import {Observable} from '../Observable'; * Returns an Observable that mirrors the source Observable, but will call a specified function when * the source terminates on complete or error. * @param {function} finallySelector function to be called when source terminates. - * @returns {Observable} an Observable that mirrors the source, but will call the specified function on termination. + * @return {Observable} an Observable that mirrors the source, but will call the specified function on termination. + * @method finally + * @owner Observable */ export function _finally(finallySelector: () => void): Observable { return this.lift(new FinallyOperator(finallySelector)); diff --git a/src/operator/find.ts b/src/operator/find.ts index 74f63f22bd1..3fa87539753 100644 --- a/src/operator/find.ts +++ b/src/operator/find.ts @@ -6,7 +6,9 @@ import {Subscriber} from '../Subscriber'; * Returns an Observable that searches for the first item in the source Observable that * matches the specified condition, and returns the first occurrence in the source. * @param {function} predicate function called with each item to test for condition matching. - * @returns {Observable} an Observable of the first item that matches the condition. + * @return {Observable} an Observable of the first item that matches the condition. + * @method find + * @owner Observable */ export function find(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable { if (typeof predicate !== 'function') { diff --git a/src/operator/findIndex.ts b/src/operator/findIndex.ts index 653d75368f3..44f8ce4eab4 100644 --- a/src/operator/findIndex.ts +++ b/src/operator/findIndex.ts @@ -5,7 +5,9 @@ import {FindValueOperator} from './find'; * Returns an Observable that searches for the first item in the source Observable that * matches the specified condition, and returns the the index of the item in the source. * @param {function} predicate function called with each item to test for condition matching. - * @returns {Observable} an Observable of the index of the first item that matches the condition. + * @return {Observable} an Observable of the index of the first item that matches the condition. + * @method findIndex + * @owner Observable */ export function findIndex(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable { return this.lift(new FindValueOperator(predicate, this, true, thisArg)); diff --git a/src/operator/first.ts b/src/operator/first.ts index c6553f9ba25..fa92678ed1b 100644 --- a/src/operator/first.ts +++ b/src/operator/first.ts @@ -7,7 +7,9 @@ import {EmptyError} from '../util/EmptyError'; * Returns an Observable that emits the first item of the source Observable that matches the specified condition. * Throws an error if matching element is not found. * @param {function} predicate function called with each item to test for condition matching. - * @returns {Observable} an Observable of the first item that matches the condition. + * @return {Observable} an Observable of the first item that matches the condition. + * @method first + * @owner Observable */ export function first(predicate?: (value: T, index: number, source: Observable) => boolean, resultSelector?: (value: T, index: number) => R, diff --git a/src/operator/groupBy.ts b/src/operator/groupBy.ts index 2c439be375c..217f4774507 100644 --- a/src/operator/groupBy.ts +++ b/src/operator/groupBy.ts @@ -14,9 +14,11 @@ import {FastMap} from '../util/FastMap'; * * @param {Function} keySelector - a function that extracts the key for each item * @param {Function} elementSelector - a function that extracts the return element for each item - * @returns {Observable} an Observable that emits GroupedObservables, each of which corresponds + * @return {Observable} an Observable that emits GroupedObservables, each of which corresponds * to a unique key value and each of which emits those items from the source Observable that share * that key value. + * @method groupBy + * @owner Observable */ export function groupBy(keySelector: (value: T) => K, elementSelector?: (value: T) => R, diff --git a/src/operator/ignoreElements.ts b/src/operator/ignoreElements.ts index ef97ae061d2..b6f2fb10a5d 100644 --- a/src/operator/ignoreElements.ts +++ b/src/operator/ignoreElements.ts @@ -8,8 +8,10 @@ import {noop} from '../util/noop'; * * * - * @returns {Observable} an empty Observable that only calls `complete` + * @return {Observable} an empty Observable that only calls `complete` * or `error`, based on which one is called by the source Observable. + * @method ignoreElements + * @owner Observable */ export function ignoreElements(): Observable { return this.lift(new IgnoreElementsOperator()); diff --git a/src/operator/inspect.ts b/src/operator/inspect.ts index acb0e8e951b..c3e5642a4e5 100644 --- a/src/operator/inspect.ts +++ b/src/operator/inspect.ts @@ -8,6 +8,12 @@ import {errorObject} from '../util/errorObject'; import {OuterSubscriber} from '../OuterSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param durationSelector + * @return {Observable|WebSocketSubject|Observable} + * @method inspect + * @owner Observable + */ export function inspect(durationSelector: (value: T) => Observable | Promise): Observable { return this.lift(new InspectOperator(durationSelector)); } diff --git a/src/operator/inspectTime.ts b/src/operator/inspectTime.ts index 8ffe536f326..178d3089e89 100644 --- a/src/operator/inspectTime.ts +++ b/src/operator/inspectTime.ts @@ -5,6 +5,13 @@ import {Subscriber} from '../Subscriber'; import {Observable} from '../Observable'; import {Subscription} from '../Subscription'; +/** + * @param delay + * @param scheduler + * @return {Observable|WebSocketSubject|Observable} + * @method inspectTime + * @owner Observable + */ export function inspectTime(delay: number, scheduler: Scheduler = asap): Observable { return this.lift(new InspectTimeOperator(delay, scheduler)); } diff --git a/src/operator/isEmpty.ts b/src/operator/isEmpty.ts index eb4b7fcc16d..2f228374e0f 100644 --- a/src/operator/isEmpty.ts +++ b/src/operator/isEmpty.ts @@ -7,7 +7,9 @@ import {Observable} from '../Observable'; * * * - * @returns {Observable} an Observable that emits a Boolean. + * @return {Observable} an Observable that emits a Boolean. + * @method isEmpty + * @owner Observable */ export function isEmpty(): Observable { return this.lift(new IsEmptyOperator()); diff --git a/src/operator/last.ts b/src/operator/last.ts index 904ac5f27d3..ec7eda5ecd8 100644 --- a/src/operator/last.ts +++ b/src/operator/last.ts @@ -12,9 +12,11 @@ import {EmptyError} from '../util/EmptyError'; * * * @param {function} predicate - the condition any source emitted item has to satisfy. - * @returns {Observable} an Observable that emits only the last item satisfying the given condition + * @return {Observable} an Observable that emits only the last item satisfying the given condition * from the source, or an NoSuchElementException if no such items are emitted. * @throws - Throws if no items that match the predicate are emitted by the source Observable. + * @method last + * @owner Observable */ export function last(predicate?: (value: T, index: number, source: Observable) => boolean, resultSelector?: (value: T, index: number) => R, diff --git a/src/operator/let.ts b/src/operator/let.ts index e97023c675f..7e3454bfc24 100644 --- a/src/operator/let.ts +++ b/src/operator/let.ts @@ -1,5 +1,11 @@ import {Observable} from '../Observable'; +/** + * @param func + * @return {Observable} + * @method let + * @owner Observable + */ export function letProto(func: (selector: Observable) => Observable): Observable { return func(this); } diff --git a/src/operator/map.ts b/src/operator/map.ts index 929fd5fd3a1..da6c591421e 100644 --- a/src/operator/map.ts +++ b/src/operator/map.ts @@ -10,7 +10,9 @@ import {Observable} from '../Observable'; * * @param {Function} project the function to create projection * @param {any} [thisArg] an optional argument to define what `this` is in the project function - * @returns {Observable} a observable of projected values + * @return {Observable} a observable of projected values + * @method map + * @owner Observable */ export function map(project: (value: T, index: number) => R, thisArg?: any): Observable { if (typeof project !== 'function') { diff --git a/src/operator/mapTo.ts b/src/operator/mapTo.ts index 56674d156b2..190a367fb42 100644 --- a/src/operator/mapTo.ts +++ b/src/operator/mapTo.ts @@ -8,7 +8,9 @@ import {Observable} from '../Observable'; * * * @param {any} value the value to map each incoming value to - * @returns {Observable} an observable of the passed value that emits every time the source does + * @return {Observable} an observable of the passed value that emits every time the source does + * @method mapTo + * @owner Observable */ export function mapTo(value: R): Observable { return this.lift(new MapToOperator(value)); diff --git a/src/operator/materialize.ts b/src/operator/materialize.ts index 3eac01bd62a..5e6c2765ac4 100644 --- a/src/operator/materialize.ts +++ b/src/operator/materialize.ts @@ -11,8 +11,10 @@ import {Notification} from '../Notification'; * * * @scheduler materialize does not operate by default on a particular Scheduler. - * @returns {Observable} an Observable that emits items that are the result of + * @return {Observable} an Observable that emits items that are the result of * materializing the items and notifications of the source Observable. + * @method materialize + * @owner Observable */ export function materialize(): Observable> { return this.lift(new MaterializeOperator()); diff --git a/src/operator/max.ts b/src/operator/max.ts index 0dd4f660511..c4c972c2929 100644 --- a/src/operator/max.ts +++ b/src/operator/max.ts @@ -9,7 +9,9 @@ import {ReduceOperator} from './reduce'; * * @param {Function} optional comparer function that it will use instead of its default to compare the value of two * items. - * @returns {Observable} an Observable that emits item with the largest number. + * @return {Observable} an Observable that emits item with the largest number. + * @method max + * @owner Observable */ export function max(comparer?: (value1: T, value2: T) => T): Observable { const max: typeof comparer = (typeof comparer === 'function') diff --git a/src/operator/merge.ts b/src/operator/merge.ts index 2c6984fcb7d..993487e51d5 100644 --- a/src/operator/merge.ts +++ b/src/operator/merge.ts @@ -10,13 +10,22 @@ import {isScheduler} from '../util/isScheduler'; * * * @param {Observable} input Observables - * @returns {Observable} an Observable that emits items that are the result of every input Observable. + * @return {Observable} an Observable that emits items that are the result of every input Observable. + * @method merge + * @owner Observable */ export function merge(...observables: Array | Scheduler | number>): Observable { observables.unshift(this); return mergeStatic.apply(this, observables); } +/** + * @param observables + * @return {Observable} + * @static true + * @name merge + * @owner Observable + */ export function mergeStatic(...observables: Array | Scheduler | number>): Observable { let concurrent = Number.POSITIVE_INFINITY; let scheduler: Scheduler = null; diff --git a/src/operator/mergeAll.ts b/src/operator/mergeAll.ts index 314f206e8ea..973b0f9a445 100644 --- a/src/operator/mergeAll.ts +++ b/src/operator/mergeAll.ts @@ -5,6 +5,12 @@ import {Subscription} from '../Subscription'; import {OuterSubscriber} from '../OuterSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param concurrent + * @return {Observable|WebSocketSubject>|Observable>} + * @method mergeAll + * @owner Observable + */ export function mergeAll(concurrent: number = Number.POSITIVE_INFINITY): T { return this.lift(new MergeAllOperator(concurrent)); } diff --git a/src/operator/mergeMap.ts b/src/operator/mergeMap.ts index 586be059800..24d72611ab0 100644 --- a/src/operator/mergeMap.ts +++ b/src/operator/mergeMap.ts @@ -14,8 +14,10 @@ import {InnerSubscriber} from '../InnerSubscriber'; * * * @param {Function} a function that, when applied to an item emitted by the source Observable, returns an Observable. - * @returns {Observable} an Observable that emits the result of applying the transformation function to each item + * @return {Observable} an Observable that emits the result of applying the transformation function to each item * emitted by the source Observable and merging the results of the Observables obtained from this transformation + * @method mergeMap + * @owner Observable */ export function mergeMap(project: (value: T, index: number) => Observable, resultSelector?: (outerValue: T, innerValue: R, outerIndex: number, innerIndex: number) => R2 | number, diff --git a/src/operator/mergeMapTo.ts b/src/operator/mergeMapTo.ts index 0d08f352b3d..ce94c6432db 100644 --- a/src/operator/mergeMapTo.ts +++ b/src/operator/mergeMapTo.ts @@ -7,6 +7,14 @@ import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param observable + * @param resultSelector + * @param concurrent + * @return {Observable|WebSocketSubject<*>|Observable<*>} + * @method mergeMapTo + * @owner Observable + */ export function mergeMapTo(observable: Observable, resultSelector?: (outerValue: T, innerValue: R, outerIndex: number, innerIndex: number) => R2 | number, concurrent: number = Number.POSITIVE_INFINITY): Observable { diff --git a/src/operator/mergeScan.ts b/src/operator/mergeScan.ts index 5652b4c184b..24be7a633b8 100644 --- a/src/operator/mergeScan.ts +++ b/src/operator/mergeScan.ts @@ -8,6 +8,14 @@ import {subscribeToResult} from '../util/subscribeToResult'; import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; +/** + * @param project + * @param seed + * @param concurrent + * @return {Observable|WebSocketSubject|Observable} + * @method mergeScan + * @owner Observable + */ export function mergeScan(project: (acc: R, value: T) => Observable, seed: R, concurrent: number = Number.POSITIVE_INFINITY): Observable { diff --git a/src/operator/min.ts b/src/operator/min.ts index 0ee8b28a8ab..42810b3a032 100644 --- a/src/operator/min.ts +++ b/src/operator/min.ts @@ -8,7 +8,9 @@ import {ReduceOperator} from './reduce'; * * * @param {Function} optional comparer function that it will use instead of its default to compare the value of two items. - * @returns {Observable} an Observable that emits item with the smallest number. + * @return {Observable} an Observable that emits item with the smallest number. + * @method min + * @owner Observable */ export function min(comparer?: (value1: T, value2: T) => T): Observable { const min: typeof comparer = (typeof comparer === 'function') diff --git a/src/operator/multicast.ts b/src/operator/multicast.ts index f87f0769141..31cc4117d88 100644 --- a/src/operator/multicast.ts +++ b/src/operator/multicast.ts @@ -11,9 +11,11 @@ import {ConnectableObservable} from '../observable/ConnectableObservable'; * as many times as needed, without causing multiple subscriptions to the source stream. * Subscribers to the given source will receive all notifications of the source from the * time of the subscription forward. - * @returns {Observable} an Observable that emits the results of invoking the selector + * @return {Observable} an Observable that emits the results of invoking the selector * on the items emitted by a `ConnectableObservable` that shares a single subscription to * the underlying stream. + * @method multicast + * @owner Observable */ export function multicast(subjectOrSubjectFactory: Subject | (() => Subject)): ConnectableObservable { let subjectFactory: () => Subject; diff --git a/src/operator/observeOn.ts b/src/operator/observeOn.ts index aca666be840..57a1933cfde 100644 --- a/src/operator/observeOn.ts +++ b/src/operator/observeOn.ts @@ -5,6 +5,13 @@ import {PartialObserver} from '../Observer'; import {Subscriber} from '../Subscriber'; import {Notification} from '../Notification'; +/** + * @param scheduler + * @param delay + * @return {Observable|WebSocketSubject|Observable} + * @method observeOn + * @owner Observable + */ export function observeOn(scheduler: Scheduler, delay: number = 0): Observable { return this.lift(new ObserveOnOperator(scheduler, delay)); } diff --git a/src/operator/pairwise.ts b/src/operator/pairwise.ts index 9dee25c2b79..2721c9faa97 100644 --- a/src/operator/pairwise.ts +++ b/src/operator/pairwise.ts @@ -9,7 +9,9 @@ import {Subscriber} from '../Subscriber'; * * * - * @returns {Observable} an observable of pairs of values. + * @return {Observable} an observable of pairs of values. + * @method pairwise + * @owner Observable */ export function pairwise(): Observable<[T, T]> { return this.lift(new PairwiseOperator()); diff --git a/src/operator/partition.ts b/src/operator/partition.ts index 000196116d7..a1801d42717 100644 --- a/src/operator/partition.ts +++ b/src/operator/partition.ts @@ -2,6 +2,13 @@ import {not} from '../util/not'; import {filter} from './filter'; import {Observable} from '../Observable'; +/** + * @param predicate + * @param thisArg + * @return {Observable[]} + * @method partition + * @owner Observable + */ export function partition(predicate: (value: T) => boolean, thisArg?: any): [Observable, Observable] { return [ filter.call(this, predicate), diff --git a/src/operator/pluck.ts b/src/operator/pluck.ts index 71e6e257fc8..c02c0b3557e 100644 --- a/src/operator/pluck.ts +++ b/src/operator/pluck.ts @@ -7,7 +7,9 @@ import {map} from './map'; * `undefined` for that value. * * @param {...args} properties the nested properties to pluck - * @returns {Observable} Returns a new Observable sequence of property values + * @return {Observable} Returns a new Observable sequence of property values + * @method pluck + * @owner Observable */ export function pluck(...properties: string[]): Observable { const length = properties.length; diff --git a/src/operator/publish.ts b/src/operator/publish.ts index 29b3d059bd1..8d704f831ab 100644 --- a/src/operator/publish.ts +++ b/src/operator/publish.ts @@ -8,7 +8,9 @@ import {ConnectableObservable} from '../observable/ConnectableObservable'; * * * - * @returns a ConnectableObservable that upon connection causes the source Observable to emit items to its Observers. + * @return a ConnectableObservable that upon connection causes the source Observable to emit items to its Observers. + * @method publish + * @owner Observable */ export function publish(): ConnectableObservable { return multicast.call(this, new Subject()); diff --git a/src/operator/publishBehavior.ts b/src/operator/publishBehavior.ts index 70030175f0c..eab65658a1d 100644 --- a/src/operator/publishBehavior.ts +++ b/src/operator/publishBehavior.ts @@ -2,6 +2,12 @@ import {BehaviorSubject} from '../subject/BehaviorSubject'; import {multicast} from './multicast'; import {ConnectableObservable} from '../observable/ConnectableObservable'; +/** + * @param value + * @return {ConnectableObservable} + * @method publishBehavior + * @owner Observable + */ export function publishBehavior(value: T): ConnectableObservable { return multicast.call(this, new BehaviorSubject(value)); } diff --git a/src/operator/publishLast.ts b/src/operator/publishLast.ts index da6f8116c4b..79ae3e6c7d1 100644 --- a/src/operator/publishLast.ts +++ b/src/operator/publishLast.ts @@ -2,6 +2,11 @@ import {AsyncSubject} from '../subject/AsyncSubject'; import {multicast} from './multicast'; import {ConnectableObservable} from '../observable/ConnectableObservable'; +/** + * @return {ConnectableObservable} + * @method publishLast + * @owner Observable + */ export function publishLast(): ConnectableObservable { return multicast.call(this, new AsyncSubject()); } diff --git a/src/operator/publishReplay.ts b/src/operator/publishReplay.ts index 556c7539d51..35a0cfae887 100644 --- a/src/operator/publishReplay.ts +++ b/src/operator/publishReplay.ts @@ -3,6 +3,14 @@ import {Scheduler} from '../Scheduler'; import {multicast} from './multicast'; import {ConnectableObservable} from '../observable/ConnectableObservable'; +/** + * @param bufferSize + * @param windowTime + * @param scheduler + * @return {ConnectableObservable} + * @method publishReplay + * @owner Observable + */ export function publishReplay(bufferSize: number = Number.POSITIVE_INFINITY, windowTime: number = Number.POSITIVE_INFINITY, scheduler?: Scheduler): ConnectableObservable { diff --git a/src/operator/race.ts b/src/operator/race.ts index f50b5ce65cc..cfdec17a46b 100644 --- a/src/operator/race.ts +++ b/src/operator/race.ts @@ -12,7 +12,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * Returns an Observable that mirrors the first source Observable to emit an item * from the combination of this Observable and supplied Observables * @param {...Observables} ...observables sources used to race for which Observable emits first. - * @returns {Observable} an Observable that mirrors the output of the first Observable to emit an item. + * @return {Observable} an Observable that mirrors the output of the first Observable to emit an item. + * @method race + * @owner Observable */ export function race(...observables: Array | Array>>): Observable { // if the only argument is an array, it was most likely called with @@ -28,7 +30,10 @@ export function race(...observables: Array | Array(...observables: Array | Array>>): Observable { // if the only argument is an array, it was most likely called with diff --git a/src/operator/reduce.ts b/src/operator/reduce.ts index 91bf910dd58..03c03ebaa8d 100644 --- a/src/operator/reduce.ts +++ b/src/operator/reduce.ts @@ -15,8 +15,10 @@ import {Subscriber} from '../Subscriber'; * @param {initialValue} the initial (seed) accumulator value * @param {accumulator} an accumulator function to be invoked on each item emitted by the source Observable, the * result of which will be used in the next accumulator call. - * @returns {Observable} an Observable that emits a single item that is the result of accumulating the output from the + * @return {Observable} an Observable that emits a single item that is the result of accumulating the output from the * items emitted by the source Observable. + * @method reduce + * @owner Observable */ export function reduce(project: (acc: R, value: T) => R, seed?: R): Observable { return this.lift(new ReduceOperator(project, seed)); diff --git a/src/operator/repeat.ts b/src/operator/repeat.ts index 102bb4004e4..668fa82791a 100644 --- a/src/operator/repeat.ts +++ b/src/operator/repeat.ts @@ -12,8 +12,10 @@ import {EmptyObservable} from '../observable/EmptyObservable'; * @param {Scheduler} [scheduler] the Scheduler to emit the items on. * @param {number} [count] the number of times the source Observable items are repeated, a count of 0 will yield * an empty Observable. - * @returns {Observable} an Observable that repeats the stream of items emitted by the source Observable at most + * @return {Observable} an Observable that repeats the stream of items emitted by the source Observable at most * count times. + * @method repeat + * @owner Observable */ export function repeat(count: number = -1): Observable { if (count === 0) { diff --git a/src/operator/retry.ts b/src/operator/retry.ts index 74b7ef3db2c..1a5636ecbbf 100644 --- a/src/operator/retry.ts +++ b/src/operator/retry.ts @@ -15,7 +15,9 @@ import {Observable} from '../Observable'; * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications * would be: [1, 2, 1, 2, 3, 4, 5, `complete`]. * @param {number} number of retry attempts before failing. - * @returns {Observable} the source Observable modified with the retry logic. + * @return {Observable} the source Observable modified with the retry logic. + * @method retry + * @owner Observable */ export function retry(count: number = -1): Observable { return this.lift(new RetryOperator(count, this)); diff --git a/src/operator/retryWhen.ts b/src/operator/retryWhen.ts index 3d08c70ea3f..db789f1882a 100644 --- a/src/operator/retryWhen.ts +++ b/src/operator/retryWhen.ts @@ -22,7 +22,9 @@ import {subscribeToResult} from '../util/subscribeToResult'; * @param {notificationHandler} receives an Observable of notifications with which a user can `complete` or `error`, * aborting the retry. * @param {scheduler} the Scheduler on which to subscribe to the source Observable. - * @returns {Observable} the source Observable modified with retry logic. + * @return {Observable} the source Observable modified with retry logic. + * @method retryWhen + * @owner Observable */ export function retryWhen(notifier: (errors: Observable) => Observable): Observable { return this.lift(new RetryWhenOperator(notifier, this)); diff --git a/src/operator/sample.ts b/src/operator/sample.ts index 907599c8fdd..54bb04a07b4 100644 --- a/src/operator/sample.ts +++ b/src/operator/sample.ts @@ -14,8 +14,10 @@ import {subscribeToResult} from '../util/subscribeToResult'; * * * @param {Observable} sampler - the Observable to use for sampling the source Observable. - * @returns {Observable} an Observable that emits the results of sampling the items emitted by this Observable + * @return {Observable} an Observable that emits the results of sampling the items emitted by this Observable * whenever the sampler Observable emits an item or completes. + * @method sample + * @owner Observable */ export function sample(notifier: Observable): Observable { return this.lift(new SampleOperator(notifier)); diff --git a/src/operator/sampleTime.ts b/src/operator/sampleTime.ts index ec881dc76a5..dcfdbc9ca0c 100644 --- a/src/operator/sampleTime.ts +++ b/src/operator/sampleTime.ts @@ -4,6 +4,13 @@ import {Subscriber} from '../Subscriber'; import {Scheduler} from '../Scheduler'; import {asap} from '../scheduler/asap'; +/** + * @param delay + * @param scheduler + * @return {Observable|WebSocketSubject|Observable} + * @method sampleTime + * @owner Observable + */ export function sampleTime(delay: number, scheduler: Scheduler = asap): Observable { return this.lift(new SampleTimeOperator(delay, scheduler)); } diff --git a/src/operator/scan.ts b/src/operator/scan.ts index 1841e83cf78..3b0eda5e9a5 100644 --- a/src/operator/scan.ts +++ b/src/operator/scan.ts @@ -11,7 +11,9 @@ import {Subscriber} from '../Subscriber'; * * * @param {any} [seed] The initial accumulator value. - * @returns {Obervable} An observable of the accumulated values. + * @return {Obervable} An observable of the accumulated values. + * @method scan + * @owner Observable */ export function scan(accumulator: (acc: R, x: T) => R, seed?: T | R): Observable { return this.lift(new ScanOperator(accumulator, seed)); diff --git a/src/operator/share.ts b/src/operator/share.ts index e2cb8574ff3..9b1b74c2d1d 100644 --- a/src/operator/share.ts +++ b/src/operator/share.ts @@ -14,7 +14,9 @@ function shareSubjectFactory() { * * * - * @returns {Observable} an Observable that upon connection causes the source Observable to emit items to its Observers + * @return {Observable} an Observable that upon connection causes the source Observable to emit items to its Observers + * @method share + * @owner Observable */ export function share(): Observable { return multicast.call(this, shareSubjectFactory).refCount(); diff --git a/src/operator/single.ts b/src/operator/single.ts index 6e414e8d2eb..3ee19796d79 100644 --- a/src/operator/single.ts +++ b/src/operator/single.ts @@ -12,9 +12,11 @@ import {EmptyError} from '../util/EmptyError'; * * * @param {Function} a predicate function to evaluate items emitted by the source Observable. - * @returns {Observable} an Observable that emits the single item emitted by the source Observable that matches + * @return {Observable} an Observable that emits the single item emitted by the source Observable that matches * the predicate. . + * @method single + * @owner Observable */ export function single(predicate?: (value: T, index: number, source: Observable) => boolean): Observable { return this.lift(new SingleOperator(predicate, this)); diff --git a/src/operator/skip.ts b/src/operator/skip.ts index 00a977e5e80..d9de840bee7 100644 --- a/src/operator/skip.ts +++ b/src/operator/skip.ts @@ -8,8 +8,10 @@ import {Observable} from '../Observable'; * * * @param {Number} the `n` of times, items emitted by source Observable should be skipped. - * @returns {Observable} an Observable that skips values emitted by the source Observable. + * @return {Observable} an Observable that skips values emitted by the source Observable. * + * @method skip + * @owner Observable */ export function skip(total: number): Observable { return this.lift(new SkipOperator(total)); diff --git a/src/operator/skipUntil.ts b/src/operator/skipUntil.ts index 9844156c727..a750fba5418 100644 --- a/src/operator/skipUntil.ts +++ b/src/operator/skipUntil.ts @@ -7,15 +7,17 @@ import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; /** -* Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item. -* -* -* -* @param {Observable} the second Observable that has to emit an item before the source Observable's elements begin to -* be mirrored by the resulting Observable. -* @returns {Observable} an Observable that skips items from the source Observable until the second Observable emits -* an item, then emits the remaining items. -*/ + * Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item. + * + * + * + * @param {Observable} the second Observable that has to emit an item before the source Observable's elements begin to + * be mirrored by the resulting Observable. + * @return {Observable} an Observable that skips items from the source Observable until the second Observable emits + * an item, then emits the remaining items. + * @method skipUntil + * @owner Observable + */ export function skipUntil(notifier: Observable): Observable { return this.lift(new SkipUntilOperator(notifier)); } diff --git a/src/operator/skipWhile.ts b/src/operator/skipWhile.ts index 1637ce8c6b2..68bd6a32712 100644 --- a/src/operator/skipWhile.ts +++ b/src/operator/skipWhile.ts @@ -9,8 +9,10 @@ import {Subscriber} from '../Subscriber'; * * * @param {Function} predicate - a function to test each item emitted from the source Observable. - * @returns {Observable} an Observable that begins emitting items emitted by the source Observable when the + * @return {Observable} an Observable that begins emitting items emitted by the source Observable when the * specified predicate becomes false. + * @method skipWhile + * @owner Observable */ export function skipWhile(predicate: (value: T, index: number) => boolean): Observable { return this.lift(new SkipWhileOperator(predicate)); diff --git a/src/operator/startWith.ts b/src/operator/startWith.ts index 2d4b699d3d5..8f1e59fb027 100644 --- a/src/operator/startWith.ts +++ b/src/operator/startWith.ts @@ -13,8 +13,10 @@ import {isScheduler} from '../util/isScheduler'; * * * @param {Values} an Iterable that contains the items you want the modified Observable to emit first. - * @returns {Observable} an Observable that emits the items in the specified Iterable and then emits the items + * @return {Observable} an Observable that emits the items in the specified Iterable and then emits the items * emitted by the source Observable. + * @method startWith + * @owner Observable */ export function startWith(...array: Array): Observable { let scheduler = array[array.length - 1]; diff --git a/src/operator/subscribeOn.ts b/src/operator/subscribeOn.ts index 72839d0c527..fa62ae4c8d8 100644 --- a/src/operator/subscribeOn.ts +++ b/src/operator/subscribeOn.ts @@ -8,8 +8,10 @@ import {SubscribeOnObservable} from '../observable/SubscribeOnObservable'; * * * @param {Scheduler} the Scheduler to perform subscription actions on. - * @returns {Observable} the source Observable modified so that its subscriptions happen on the specified Scheduler + * @return {Observable} the source Observable modified so that its subscriptions happen on the specified Scheduler . + * @method subscribeOn + * @owner Observable */ export function subscribeOn(scheduler: Scheduler, delay: number = 0): Observable { return new SubscribeOnObservable(this, delay, scheduler); diff --git a/src/operator/switch.ts b/src/operator/switch.ts index 184dfadbed2..fca5cd756fe 100644 --- a/src/operator/switch.ts +++ b/src/operator/switch.ts @@ -17,8 +17,10 @@ import {subscribeToResult} from '../util/subscribeToResult'; * new one. * * @param {Function} a predicate function to evaluate items emitted by the source Observable. - * @returns {Observable} an Observable that emits the items emitted by the Observable most recently emitted by the + * @return {Observable} an Observable that emits the items emitted by the Observable most recently emitted by the * source Observable. + * @method switch + * @owner Observable */ export function _switch(): T { return this.lift(new SwitchOperator()); diff --git a/src/operator/switchMap.ts b/src/operator/switchMap.ts index 4b85ab05327..b5ff19ed2df 100644 --- a/src/operator/switchMap.ts +++ b/src/operator/switchMap.ts @@ -13,8 +13,10 @@ import {subscribeToResult} from '../util/subscribeToResult'; * * * @param {Observable} a function that, when applied to an item emitted by the source Observable, returns an Observable. - * @returns {Observable} an Observable that emits the items emitted by the Observable returned from applying func to + * @return {Observable} an Observable that emits the items emitted by the Observable returned from applying func to * the most recently emitted item emitted by the source Observable. + * @method switchMap + * @owner Observable */ export function switchMap(project: (value: T, index: number) => Observable, resultSelector?: ( diff --git a/src/operator/switchMapTo.ts b/src/operator/switchMapTo.ts index ea712ff0f82..9c911f6135a 100644 --- a/src/operator/switchMapTo.ts +++ b/src/operator/switchMapTo.ts @@ -6,6 +6,13 @@ import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param observable + * @param resultSelector + * @return {Observable|WebSocketSubject|Observable} + * @method switchMapTo + * @owner Observable + */ export function switchMapTo(observable: Observable, resultSelector?: ( outerValue: T, diff --git a/src/operator/take.ts b/src/operator/take.ts index 87ada04e655..343ced4fe21 100644 --- a/src/operator/take.ts +++ b/src/operator/take.ts @@ -4,6 +4,12 @@ import {ArgumentOutOfRangeError} from '../util/ArgumentOutOfRangeError'; import {EmptyObservable} from '../observable/EmptyObservable'; import {Observable} from '../Observable'; +/** + * @param total + * @return {any} + * @method take + * @owner Observable + */ export function take(total: number): Observable { if (total === 0) { return new EmptyObservable(); diff --git a/src/operator/takeLast.ts b/src/operator/takeLast.ts index 1c5504d32ed..4c151c0d053 100644 --- a/src/operator/takeLast.ts +++ b/src/operator/takeLast.ts @@ -4,6 +4,12 @@ import {ArgumentOutOfRangeError} from '../util/ArgumentOutOfRangeError'; import {EmptyObservable} from '../observable/EmptyObservable'; import {Observable} from '../Observable'; +/** + * @param total + * @return {any} + * @method takeLast + * @owner Observable + */ export function takeLast(total: number): Observable { if (total === 0) { return new EmptyObservable(); diff --git a/src/operator/takeUntil.ts b/src/operator/takeUntil.ts index 030935f9c07..fe2a2085008 100644 --- a/src/operator/takeUntil.ts +++ b/src/operator/takeUntil.ts @@ -6,6 +6,12 @@ import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param notifier + * @return {Observable|WebSocketSubject|Observable} + * @method takeUntil + * @owner Observable + */ export function takeUntil(notifier: Observable): Observable { return this.lift(new TakeUntilOperator(notifier)); } diff --git a/src/operator/takeWhile.ts b/src/operator/takeWhile.ts index c056ee9c413..07c02f2c8a1 100644 --- a/src/operator/takeWhile.ts +++ b/src/operator/takeWhile.ts @@ -2,6 +2,12 @@ import {Operator} from '../Operator'; import {Observable} from '../Observable'; import {Subscriber} from '../Subscriber'; +/** + * @param predicate + * @return {Observable|WebSocketSubject|Observable} + * @method takeWhile + * @owner Observable + */ export function takeWhile(predicate: (value: T, index: number) => boolean): Observable { return this.lift(new TakeWhileOperator(predicate)); } diff --git a/src/operator/throttle.ts b/src/operator/throttle.ts index fd2ab80a2d3..e28d8739511 100644 --- a/src/operator/throttle.ts +++ b/src/operator/throttle.ts @@ -7,6 +7,12 @@ import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param durationSelector + * @return {Observable|WebSocketSubject|Observable} + * @method throttle + * @owner Observable + */ export function throttle(durationSelector: (value: T) => Observable | Promise): Observable { return this.lift(new ThrottleOperator(durationSelector)); } diff --git a/src/operator/throttleTime.ts b/src/operator/throttleTime.ts index 217743da4c0..c31b964a3cd 100644 --- a/src/operator/throttleTime.ts +++ b/src/operator/throttleTime.ts @@ -5,6 +5,13 @@ import {Subscription} from '../Subscription'; import {asap} from '../scheduler/asap'; import {Observable} from '../Observable'; +/** + * @param delay + * @param scheduler + * @return {Observable|WebSocketSubject|Observable} + * @method throttleTime + * @owner Observable + */ export function throttleTime(delay: number, scheduler: Scheduler = asap): Observable { return this.lift(new ThrottleTimeOperator(delay, scheduler)); } diff --git a/src/operator/timeInterval.ts b/src/operator/timeInterval.ts index a8de5032abf..aa14bb15e7f 100644 --- a/src/operator/timeInterval.ts +++ b/src/operator/timeInterval.ts @@ -4,6 +4,12 @@ import {Subscriber} from '../Subscriber'; import {Scheduler} from '../Scheduler'; import {asap} from '../scheduler/asap'; +/** + * @param scheduler + * @return {Observable>|WebSocketSubject|Observable} + * @method timeInterval + * @owner Observable + */ export function timeInterval(scheduler: Scheduler = asap): Observable> { return this.lift(new TimeIntervalOperator(scheduler)); } diff --git a/src/operator/timeout.ts b/src/operator/timeout.ts index 7738fe6a483..6dced583a87 100644 --- a/src/operator/timeout.ts +++ b/src/operator/timeout.ts @@ -5,6 +5,14 @@ import {Subscriber} from '../Subscriber'; import {Scheduler} from '../Scheduler'; import {Observable} from '../Observable'; +/** + * @param due + * @param errorToSend + * @param scheduler + * @return {Observable|WebSocketSubject|Observable} + * @method timeout + * @owner Observable + */ export function timeout(due: number | Date, errorToSend: any = null, scheduler: Scheduler = asap): Observable { diff --git a/src/operator/timeoutWith.ts b/src/operator/timeoutWith.ts index 0de6f481719..638fc61df68 100644 --- a/src/operator/timeoutWith.ts +++ b/src/operator/timeoutWith.ts @@ -8,6 +8,14 @@ import {isDate} from '../util/isDate'; import {OuterSubscriber} from '../OuterSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param due + * @param withObservable + * @param scheduler + * @return {Observable|WebSocketSubject|Observable} + * @method timeoutWith + * @owner Observable + */ export function timeoutWith(due: number | Date, withObservable: Observable, scheduler: Scheduler = asap): Observable { diff --git a/src/operator/toArray.ts b/src/operator/toArray.ts index 38b927e8bd6..8068cfd9fd2 100644 --- a/src/operator/toArray.ts +++ b/src/operator/toArray.ts @@ -2,6 +2,11 @@ import {Operator} from '../Operator'; import {Subscriber} from '../Subscriber'; import {Observable} from '../Observable'; +/** + * @return {Observable|WebSocketSubject|Observable} + * @method toArray + * @owner Observable + */ export function toArray(): Observable { return this.lift(new ToArrayOperator()); } diff --git a/src/operator/toPromise.ts b/src/operator/toPromise.ts index 66196ebe4a8..e529d6cb50b 100644 --- a/src/operator/toPromise.ts +++ b/src/operator/toPromise.ts @@ -1,5 +1,11 @@ import {root} from '../util/root'; +/** + * @param PromiseCtor + * @return {Promise} + * @method toPromise + * @owner Observable + */ export function toPromise(PromiseCtor?: typeof Promise): Promise { if (!PromiseCtor) { if (root.Rx && root.Rx.config && root.Rx.config.Promise) { diff --git a/src/operator/window.ts b/src/operator/window.ts index f41d79b514e..129ec0e713f 100644 --- a/src/operator/window.ts +++ b/src/operator/window.ts @@ -7,6 +7,12 @@ import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param closingNotifier + * @return {Observable>|WebSocketSubject|Observable} + * @method window + * @owner Observable + */ export function window(closingNotifier: Observable): Observable> { return this.lift(new WindowOperator(closingNotifier)); } diff --git a/src/operator/windowCount.ts b/src/operator/windowCount.ts index 537dbc96c53..3750aca03ce 100644 --- a/src/operator/windowCount.ts +++ b/src/operator/windowCount.ts @@ -3,6 +3,13 @@ import {Subscriber} from '../Subscriber'; import {Observable} from '../Observable'; import {Subject} from '../Subject'; +/** + * @param windowSize + * @param startWindowEvery + * @return {Observable>|WebSocketSubject|Observable} + * @method windowCount + * @owner Observable + */ export function windowCount(windowSize: number, startWindowEvery: number = 0): Observable> { return this.lift(new WindowCountOperator(windowSize, startWindowEvery)); diff --git a/src/operator/windowTime.ts b/src/operator/windowTime.ts index bf68d4a4b10..6a5a884d44c 100644 --- a/src/operator/windowTime.ts +++ b/src/operator/windowTime.ts @@ -6,6 +6,14 @@ import {Scheduler} from '../Scheduler'; import {Action} from '../scheduler/Action'; import {asap} from '../scheduler/asap'; +/** + * @param windowTimeSpan + * @param windowCreationInterval + * @param scheduler + * @return {Observable>|WebSocketSubject|Observable} + * @method windowTime + * @owner Observable + */ export function windowTime(windowTimeSpan: number, windowCreationInterval: number = null, scheduler: Scheduler = asap): Observable> { diff --git a/src/operator/windowToggle.ts b/src/operator/windowToggle.ts index 23ffc1aba04..8e522b01319 100644 --- a/src/operator/windowToggle.ts +++ b/src/operator/windowToggle.ts @@ -11,6 +11,13 @@ import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param openings + * @param closingSelector + * @return {Observable>|WebSocketSubject|Observable} + * @method windowToggle + * @owner Observable + */ export function windowToggle(openings: Observable, closingSelector: (openValue: O) => Observable): Observable> { return this.lift(new WindowToggleOperator(openings, closingSelector)); diff --git a/src/operator/windowWhen.ts b/src/operator/windowWhen.ts index 877d875e8dc..0d95fa0bed2 100644 --- a/src/operator/windowWhen.ts +++ b/src/operator/windowWhen.ts @@ -11,6 +11,12 @@ import {OuterSubscriber} from '../OuterSubscriber'; import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; +/** + * @param closingSelector + * @return {Observable>|WebSocketSubject|Observable} + * @method windowWhen + * @owner Observable + */ export function windowWhen(closingSelector: () => Observable): Observable> { return this.lift(new WindowOperator(closingSelector)); } diff --git a/src/operator/withLatestFrom.ts b/src/operator/withLatestFrom.ts index 350de99a528..2e726c84ee8 100644 --- a/src/operator/withLatestFrom.ts +++ b/src/operator/withLatestFrom.ts @@ -22,6 +22,8 @@ import {subscribeToResult} from '../util/subscribeToResult'; * C: --x----------------y-------------z-------------| * result: ---([a,d,x])---------([b,e,y])--------([c,f,z])---| * ``` + * @method withLatestFrom + * @owner Observable */ export function withLatestFrom(...args: Array | ((...values: Array) => R)>): Observable { let project: any; diff --git a/src/operator/zip.ts b/src/operator/zip.ts index f0e0e592df4..c111437f853 100644 --- a/src/operator/zip.ts +++ b/src/operator/zip.ts @@ -9,6 +9,12 @@ import {InnerSubscriber} from '../InnerSubscriber'; import {subscribeToResult} from '../util/subscribeToResult'; import {SymbolShim} from '../util/SymbolShim'; +/** + * @param observables + * @return {Observable} + * @method zip + * @owner Observable + */ export function zipProto(...observables: Array | ((...values: Array) => R)>): Observable { observables.unshift(this); return zipStatic.apply(this, observables); @@ -52,6 +58,14 @@ export function zipStatic(...observables: Array | ((...v export function zipStatic(array: ObservableInput[]): Observable; export function zipStatic(array: ObservableInput[], project: (...values: Array) => R): Observable; /* tslint:enable:max-line-length */ + +/** + * @param observables + * @return {Observable} + * @static true + * @name zip + * @owner Observable + */ export function zipStatic(...observables: Array | ((...values: Array) => R)>): Observable { const project = <((...ys: Array) => R)> observables[observables.length - 1]; if (typeof project === 'function') { diff --git a/src/operator/zipAll.ts b/src/operator/zipAll.ts index 3f33b3d88fa..727b64a344f 100644 --- a/src/operator/zipAll.ts +++ b/src/operator/zipAll.ts @@ -1,6 +1,12 @@ import {ZipOperator} from './zip'; import {Observable} from '../Observable'; +/** + * @param project + * @return {Observable|WebSocketSubject|Observable} + * @method zipAll + * @owner Observable + */ export function zipAll(project?: (...values: Array) => R): Observable { return this.lift(new ZipOperator(project)); } diff --git a/tools/custom-esdoc-plugin.js b/tools/custom-esdoc-plugin.js new file mode 100644 index 00000000000..3111eb863a5 --- /dev/null +++ b/tools/custom-esdoc-plugin.js @@ -0,0 +1,53 @@ +// Fixes ESDoc structure by moving all "add-able" operator functions +// (either prototype operator or static operator) under the Observable class. +// Looks for the "@owner" tag, then moves the thing to that owner. "@owner" is +// usually "Observable", but may be something else. +exports.onHandleTag = function onHandleTag(ev) { + function getTagValue(tag, tagName) { + var unknownTags = tag.unknown; + if (!unknownTags) { + return null; + } + var unknownTagsLength = unknownTags.length; + for (var i = 0; i < unknownTagsLength; i++) { + if (unknownTags[i].tagName === tagName) { + return unknownTags[i].tagValue; + } + } + return null; + } + + function getLongname(name) { + var index = ev.data.tag.findIndex(function (t) { + return t.name === name; + }); + if (index === -1) { + throw new Error('Could not find longname for unknown tag named "' + name + + '"'); + } else { + return ev.data.tag[index].longname; + } + } + + var tagsLen = ev.data.tag.length; + for (var i = 0; i < tagsLen; i++) { + var tag = ev.data.tag[i]; + var owner = getTagValue(tag, '@owner'); + var name = getTagValue(tag, '@name'); + var isStatic = getTagValue(tag, '@static'); + if (owner) { + var ownerLongname = getLongname(owner); + tag.kind = 'method'; + tag.static = false; + tag.memberof = ownerLongname; + if (name) { + tag.name = name; + } + if (isStatic) { + tag.static = true; + } + delete tag.importPath; + delete tag.importStyle; + } + } +};