Skip to content

Commit

Permalink
docs(fromEvent): update the example to match the actual API (#7246)
Browse files Browse the repository at this point in the history
Resolves: #7245
(cherry picked from commit 3812d16)
  • Loading branch information
demensky authored and jakovljevic-mladen committed Apr 12, 2023
1 parent ceb821c commit e88a266
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/internal/observable/fromEvent.ts
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 e88a266

Please sign in to comment.