refactor(Observable): implement toPromise and fromPromise without side effects

BREAKING CHANGE:

toPromise is no longer an instance method of the `Observable` returned
by Angular, and fromPromise is no longer available as a static method.

The easiest way to account for this change in applications is to import
the auto-patching modules from rxjs, which will automatically add these
operators back to the Observable prototype.

```
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/observable/fromPromise';
```

Closes #5542
Closes #5626
This commit is contained in:
Jeff Cross
2015-12-04 09:09:57 -08:00
parent 1f35048d54
commit c39f4c3b38
7 changed files with 13 additions and 18 deletions

View File

@ -6,8 +6,8 @@ import {Connection, ConnectionBackend} from '../interfaces';
import {isPresent} from 'angular2/src/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import {Subject} from 'rxjs/Subject';
import {ReplaySubject} from 'rxjs/subjects/ReplaySubject';
import 'rxjs/operators/take';
import {ReplaySubject} from 'rxjs/subject/ReplaySubject';
import {take} from 'rxjs/operator/take';
/**
*
@ -35,7 +35,7 @@ export class MockConnection implements Connection {
response: any; // Subject<Response>
constructor(req: Request) {
this.response = new ReplaySubject(1).take(1);
this.response = take.call(new ReplaySubject(1), 1);
this.readyState = ReadyState.Open;
this.request = req;
}