easy - accepted / - tried
This is a follow-up on 57. create an Observable.
Suppose you have solved 57. create an Observable, here you are asked to implement a creation operator
fromEvent()( for DOM Event)
From the document,
Creates an Observable that emits events of a specific type coming from the given event target.
Simply speaking, it is a util to attach event listener in Observable fashion.
const source = fromEvent(node, 'click') source.subscribe((e) => console.log(e))
node is clicked, the event is logged.
- Observable is already given for you, no need to create it.
- the event listener removal is handled by add(), which is beyond our scope here, you can ignore that.
Let's try to solve this problem within 10 mintues.