RxJS Functions (Part 10)

Corey Pyle
1 min readJan 17, 2019

--

generate

Solar power was never worth it in Sim City…

generate

Use it instead of nexting values in a for loop.

TL;DR

If you want to use a for loop, but you want to emit from an Observable for every iteration, you can use generate.

Use Case

I haven’t come across a specific use case for generate. I suppose you could use it to generate a higher order Observable. If anyone can think of a good use for it let me know and I’ll write up an example.

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

--

--