From 2913340af787597284321f472f5637875f94ee98 Mon Sep 17 00:00:00 2001 From: Judy Bogart Date: Mon, 22 Jul 2019 09:03:38 -0700 Subject: [PATCH] docs: update rxjs refs (#31780) PR Close #31780 --- aio/content/guide/observables-in-angular.md | 6 ++++-- aio/content/guide/rx-library.md | 4 ++-- packages/core/src/event_emitter.ts | 11 ++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/aio/content/guide/observables-in-angular.md b/aio/content/guide/observables-in-angular.md index ff7f3be3dd..a8648bf454 100644 --- a/aio/content/guide/observables-in-angular.md +++ b/aio/content/guide/observables-in-angular.md @@ -2,13 +2,15 @@ Angular makes use of observables as an interface to handle a variety of common asynchronous operations. For example: -* The `EventEmitter` class extends `Observable`. +* The `EventEmitter` class lets you use observables with the Angular `@Output` decorator. * The HTTP module uses observables to handle AJAX requests and responses. * The Router and Forms modules use observables to listen for and respond to user-input events. ## Event emitter -Angular provides an `EventEmitter` class that is used when publishing values from a component through the `@Output()` decorator. `EventEmitter` extends `Observable`, adding an `emit()` method so it can send arbitrary values. When you call `emit()`, it passes the emitted value to the `next()` method of any subscribed observer. +Angular provides an `EventEmitter` class that is used when publishing values from a component through the `@Output()` decorator. +`EventEmitter` extends [RxJS `Subject`](https://rxjs.dev/api/index/class/Subject), adding an `emit()` method so it can send arbitrary values. +When you call `emit()`, it passes the emitted value to the `next()` method of any subscribed observer. A good example of usage can be found on the [EventEmitter](https://angular.io/api/core/EventEmitter) documentation. Here is the example component that listens for open and close events: diff --git a/aio/content/guide/rx-library.md b/aio/content/guide/rx-library.md index 22bc14bcf1..8aed26dcce 100644 --- a/aio/content/guide/rx-library.md +++ b/aio/content/guide/rx-library.md @@ -1,6 +1,6 @@ # The RxJS library -Reactive programming is an asynchronous programming paradigm concerned with data streams and the propagation of change ([Wikipedia](https://en.wikipedia.org/wiki/Reactive_programming)). RxJS (Reactive Extensions for JavaScript) is a library for reactive programming using observables that makes it easier to compose asynchronous or callback-based code ([RxJS Docs](http://reactivex.io/rxjs/)). +Reactive programming is an asynchronous programming paradigm concerned with data streams and the propagation of change ([Wikipedia](https://en.wikipedia.org/wiki/Reactive_programming)). RxJS (Reactive Extensions for JavaScript) is a library for reactive programming using observables that makes it easier to compose asynchronous or callback-based code. See ([RxJS Docs](https://rxjs.dev/guide/overview)). RxJS provides an implementation of the `Observable` type, which is needed until the type becomes part of the language and until browsers support it. The library also provides utility functions for creating and working with observables. These utility functions can be used for: @@ -45,7 +45,7 @@ The `pipe()` function is also a method on the RxJS `Observable`, so you use this ### Common operators -RxJS provides many operators, but only a handful are used frequently. For a list of operators and usage samples, visit the [RxJS API Documentation](https://rxjs-dev.firebaseapp.com/api). +RxJS provides many operators, but only a handful are used frequently. For a list of operators and usage samples, visit the [RxJS API Documentation](https://rxjs.dev/api).
Note that, for Angular apps, we prefer combining operators with pipes, rather than chaining. Chaining is used in many RxJS examples. diff --git a/packages/core/src/event_emitter.ts b/packages/core/src/event_emitter.ts index 9dc180dadc..d30ccf9a51 100644 --- a/packages/core/src/event_emitter.ts +++ b/packages/core/src/event_emitter.ts @@ -11,12 +11,16 @@ import {Subject, Subscription} from 'rxjs'; /** - * Use in directives and components to emit custom events synchronously - * or asynchronously, and register handlers for those events by subscribing - * to an instance. + * Use in components with the `@Output` directive to emit custom events + * synchronously or asynchronously, and register handlers for those events + * by subscribing to an instance. * * @usageNotes * + * Extends + * [RxJS `Subject`](https://rxjs.dev/api/index/class/Subject) + * for Angular by adding the `emit()` method. + * * In the following example, a component defines two output properties * that create event emitters. When the title is clicked, the emitter * emits an open or close event to toggle the current visibility state. @@ -54,6 +58,7 @@ import {Subject, Subscription} from 'rxjs'; * * ``` * + * @see [Observables: Event emitter](guide/observables-in-angular#event-emitter) * @publicApi */ export class EventEmitter extends Subject {