Reactive-101 Flashcards
What is the main focus for Reactive?
main focus is working with
an asynchronous data
What is the more in Reactive compared to events?
It listen , acts, and create event streams
Write some usages of R..ive?
Graphical user interface •Animation •Robotics •Simulation •Computer vision
What this depicts?
() = {} , it says the implementation of a funtion and has no arg , arg => {} , like this is with arg
What does map and take do
map listens to each event, for e.g. arr has 5 elements , so it will 5 events and map will to all five, take will limit the max events the map has listen to
What are Observables & Observers?
Observers listen to event streams & Observables relay the event streams
What are hot and cold Observables?
Hot Observables they emit irrespective of observer, like mouseevents , A cold observable, on the other hand, is an observable
that fires the same sequence for all the subscribers. An
example of a cold observable is an observable created
from an array.
Can we turn a cold into Observables
Yes in Rxjs
What the from will do?
It can create an observable from an iterable , array , set or map
What is the form of from
Observable.from([0,1,2]).subscribe( a => {})
How to use mapFunction to propagate the double of each element
Rx.Observable
.from([0,1,2], (a) => a*2)
.subscribe((a)=>console.log(a));
Does from takes map and set also?
Yes
What does range do?
It applies the start and last range
How will you Create an observable using period of time?
using interval(millis), and interval is a cold observer so you need to have subscribed
Is there any timer function in rxjs?
Rx.Observable.timer(dueTime, [interval], [scheduler]);
//scheduler is always optional