angular - Rxjs: The scan operator -
i have been reading code if replace scan map can not property "gettime" of undefined, why happening assume both operator takes item emits observable , apply function on it
this.clock = observable.merge(         this.click$,         observable.interval(5000)     )         .startwith(new date())         .map((acc : date)=> {             const date = new date(acc.gettime());              date.setseconds(date.getseconds() + 1);             return date;         }); 
because merge 2 streams single one. receive events click$ or interval. in these cases, aren't of type date can use gettime method.
the scan operator allows keeping state between events. map 1 converts input output. in case of last one, receive event itself...
Comments
Post a Comment