`Rx.Observable.from` does not properly handle `NodeList`
See original GitHub issueConsider the following code:
const buttons = document.querySelectorAll('.btn');
const button$ = Rx.Observable.from(buttons);
const button2$ = Rx.Observable.from(buttons);
button$.subscribe(x => console.log('observer 1 ', x)); // emit
button$.subscribe(x => console.log('observer 2 ', x)); // nothing
button2$.subscribe(x => console.log('observer 3 ', x)); // emit
Rx.Observable.from
should result in a cold observable that emit the same list each time it is subscribed. However, in this example the source is a NodeList and the second subscription does not emit.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Observable | RxJS API Document - ReactiveX
Creates an Observable that emits events of a specific type coming from the given event target. Creates an Observable from an API based...
Read more >Bridging To Events | RxJS - Javascript library for functional ...
Every time an event is raised, an onNext message will be delivered to the observable sequence. You can then manipulate event data just...
Read more >Property 'from' does not exist on type 'typeof Observable ...
I updated my angular 5.2.10 project to angular 6. I did step by step https://update.angular.io/ , everything is OK unless Observable.
Read more >fromEvent - RxJS
Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is installed and removed...
Read more >How to Create Observables in RxJS - Better Programming
RxJS is the most popular framework for functional reactive programming (FRP) in JavaScript. Angular is entirely built around RxJS and FRP ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cartant Yes i did know that, but thanks for the suggestion anyway. It’s exactly what i suggested @mocheng on gitter 3 november 2017 12:14 as he’s the one that came up with this scenario.
@kwonoj No prob about the confusion, at least it kept the issue active and quickly resolved 😃
@Dorus You most likely already know this, but you can work around the problem in version 5 using
defer
: