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:
511 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | import { Observable } from '../Observable';
|
---|
| 2 | import { SchedulerLike } from '../types';
|
---|
| 3 | import { subscribeToIterable } from '../util/subscribeToIterable';
|
---|
| 4 | import { scheduleIterable } from '../scheduled/scheduleIterable';
|
---|
| 5 |
|
---|
| 6 | export function fromIterable<T>(input: Iterable<T>, scheduler?: SchedulerLike) {
|
---|
| 7 | if (!input) {
|
---|
| 8 | throw new Error('Iterable cannot be null');
|
---|
| 9 | }
|
---|
| 10 | if (!scheduler) {
|
---|
| 11 | return new Observable<T>(subscribeToIterable(input));
|
---|
| 12 | } else {
|
---|
| 13 | return scheduleIterable(input, scheduler);
|
---|
| 14 | }
|
---|
| 15 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.