Skip to content

Commit

Permalink
docs(fromEvent): update the example to match the actual API
Browse files Browse the repository at this point in the history
Resolves: ReactiveX#7245
  • Loading branch information
demensky committed Apr 10, 2023
1 parent 8e2dd88 commit aafa3ab
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/internal/observable/fromEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,13 @@ export function fromEvent<T, R>(
* ```ts
* import { fromEvent } from 'rxjs';
*
* const clicksInDocument = fromEvent(document, 'click', true); // note optional configuration parameter
* // which will be passed to addEventListener
* const clicksInDiv = fromEvent(someDivInDocument, 'click');
* const div = document.createElement('div');
* div.style.cssText = 'width: 200px; height: 200px; background: #09c;';
* document.body.appendChild(div);
*
* // note optional configuration parameter which will be passed to addEventListener
* const clicksInDocument = fromEvent(document, 'click', { capture: true });
* const clicksInDiv = fromEvent(div, 'click');
*
* clicksInDocument.subscribe(() => console.log('document'));
* clicksInDiv.subscribe(() => console.log('div'));
Expand Down

0 comments on commit aafa3ab

Please sign in to comment.