I start of with a (probably not impressive and in a 1000 ways improvable) simple timer used to hide an popup after a short while. The timer gets reset, if the popup is triggered again.
exportclassPopupComponent{private_triggerPopup$=newSubject<any>();// typing aren't needed since TypeScript will get the type by parsing the codeisShowPopup$=this._triggerPopup$.pipe(switchMap(()=>timer(POPUP_TIMEOUT_DURATION).pipe(mapTo(false),startWith(true)// until the timer fires, you'll have this value)),);}
I start of with a (probably not impressive and in a 1000 ways improvable) simple timer used to hide an popup after a short while. The timer gets reset, if the popup is triggered again.
How about?
I don't know if this could be optimized further 😅
I've to admit that's prettier than mine! :)
It's a shame that this article didn't get more attention. I catch myself coming back to this particular comment time and time again :D