RxJS Functions (Part 13)

Corey Pyle
1 min readJan 21, 2019

--

interval

interval

https://rxjs.dev/api/index/function/interval

Creates an Observable that emits sequential numbers every specified interval of time, on a specified SchedulerLike.

TL;DR

See description from docs above.

Use Case

One of the best uses for interval that I’ve found is using it to refresh a user’s credentials. You can setup the interval to occur at a configured value and every time the Observable emits have it hit your refresh API. Use it in conjunction with something like NgRx/Redux and you can setup a nice automatic logout system:

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

--

--