Skip to content

Commit

Permalink
fix(fromObservable): use Symbol.observable to get observable
Browse files Browse the repository at this point in the history
In fromObservable, use Symbol.observable if present to get observable. If not present,treat received
object as a subscribable (current behaviour).
  • Loading branch information
troch authored and staltz committed May 18, 2018
1 parent 328fbad commit 3a4271c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,8 @@ export class Stream<T> implements InternalListener<T> {
*/
static fromObservable<T>(obs: {subscribe: any}): Stream<T> {
if ((obs as Stream<T>).endWhen) return obs as Stream<T>;
return new Stream<T>(new FromObservable(obs));
const o = typeof obs[$$observable] === 'function' ? obs[$$observable]() : obs;
return new Stream<T>(new FromObservable(o));
}

/**
Expand Down

0 comments on commit 3a4271c

Please sign in to comment.