Skip to content

Commit

Permalink
docs(distinct): update distinct docs to fit new API
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Oct 24, 2016
1 parent b2373a1 commit 11894d0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/operator/distinct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import { ISet, Set } from '../util/Set';

/**
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
* 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.
* As the internal HashSet of this operator grows larger and larger, care should be taken in the domain of inputs this operator may see.
* 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} [keySelector] optional function to select which value you want to check as distinct
* @param {function} [compare] optional comparison function called to test if an item is distinct from previous items in the source.
* If a keySelector function is provided, then it will project each value from the source observable into a new value that it will
* check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the
* source observable directly with an equality check against previous values.
* In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.
* In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the
* hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`
* use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so
* that the internal `Set` can be "flushed", basically clearing it of values.
* @param {function} [keySelector] optional function to select which value you want to check as distinct.
* @param {Observable} [flushes] optional Observable for flushing the internal HashSet of the operator.
* @return {Observable} an Observable that emits items from the source Observable with distinct values.
* @method distinct
Expand Down

0 comments on commit 11894d0

Please sign in to comment.