RxJS Functions (Part 9)

Corey Pyle
1 min readJan 16, 2019

--

fromEventPattern

fromEventPattern

Creates an Observable from an arbitrary API for registering event handlers.

Note: A gif didn’t seem super useful here.

TL;DR

For creating an Observable from an event whose API for adding listeners does not match the (target, eventName) call signature.

Use Case

I won’t belabor this one. fromEventPattern is basically the more flexible version of fromEvent. Any time you want to use fromEvent, but think you can’t because your event emitter doesn’t seem to fit the form, check out fromEventPattern.

Thanks for reading. Stay tuned for Part 10, and be sure to checkout my previous articles.

--

--