Rxjs:- Interval,Timer

--

We are creating a “Interval” Rxjs Operator for the time specify 1 second that return the value 1,2,3,4… etc, This is call as simply as a method

Interval:-
const interval$ = interval(1000);
interval.subscribe((val)=> {
console.log(“interval val: ” val)
})
// return 1,2,3,4,5……

Timer:- takes two arguments
1- First take initial delay before start
2-Second time interval

const timer$ = timer(3000,1000)
timer.subscribe((val)=> {
console.log(“timer ” val)
})

fromEvent() method
Click event using Rxjs method “fromEvent, it will take two arguments
1-Source of the click
2- event you are subscribing
const click$ =(document,”click”);
click$.subscribe((e)=> (console.log(e)

--

--

Ajay Kumar Maheshwari - [Frontend Developer]

Currently working as UI Frontend Developer I have worked on multiple domains such as E-learning, E-commerce HTML5, CSS3, JavaScript, SASS, Responsive,Angular