This repository was archived by the owner on Oct 1, 2018. It is now read-only.
File tree 1 file changed +40
-2
lines changed
src/operator-docs/creation
1 file changed +40
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { OperatorDoc } from '../operator.model' ;
2
2
3
3
export const fromPromise : OperatorDoc = {
4
- 'name' : 'fromPromise' ,
5
- 'operatorType' : 'creation'
4
+ name : 'fromPromise' ,
5
+ operatorType : 'creation' ,
6
+ signature :
7
+ 'public static fromPromise(promise: Promise<T>, scheduler: Scheduler): Observable<T>' ,
8
+ parameters : [
9
+ {
10
+ name : 'promise' ,
11
+ type : 'Promise<T>' ,
12
+ attribute : '' ,
13
+ description : 'The promise to be converted.'
14
+ } ,
15
+ {
16
+ name : 'scheduler' ,
17
+ type : 'Scheduler' ,
18
+ attribute : 'optional' ,
19
+ description :
20
+ 'An optional IScheduler to use for scheduling the delivery of the resolved value (or the rejection).s'
21
+ }
22
+ ] ,
23
+ shortDescription : {
24
+ description : 'Converts a Promise to an Observable.'
25
+ } ,
26
+ walkthrough : {
27
+ description : `Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an Observable.
28
+ If the Promise resolves with a value, the output Observable emits that resolved value as a next,
29
+ and then completes. If the Promise is rejected, then the output Observable emits the corresponding Error.`
30
+ } ,
31
+ examples : [
32
+ {
33
+ name : 'Convert the Promise returned by Fetch to an Observable' ,
34
+ code : `
35
+ const result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));
36
+ result.subscribe(x => console.log(x), e => console.error(e));` ,
37
+ externalLink : {
38
+ platform : 'JSBin' ,
39
+ url : 'http://jsbin.com/warotosaco/embed?js,console,output'
40
+ }
41
+ }
42
+ ] ,
43
+ relatedOperators : [ 'bindCallback' , 'from' , 'toPromise' ]
6
44
} ;
You can’t perform that action at this time.
0 commit comments