Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
516 bytes
|
Line | |
---|
1 | import { Observable } from '../Observable';
|
---|
2 | import { from } from './from';
|
---|
3 | import { empty } from './empty';
|
---|
4 | export function defer(observableFactory) {
|
---|
5 | return new Observable(subscriber => {
|
---|
6 | let input;
|
---|
7 | try {
|
---|
8 | input = observableFactory();
|
---|
9 | }
|
---|
10 | catch (err) {
|
---|
11 | subscriber.error(err);
|
---|
12 | return undefined;
|
---|
13 | }
|
---|
14 | const source = input ? from(input) : empty();
|
---|
15 | return source.subscribe(subscriber);
|
---|
16 | });
|
---|
17 | }
|
---|
18 | //# sourceMappingURL=defer.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.