I am a beginner with angular 2 and I have a value that is linked to user interaction that needs to be sent over http requests. The value can change multiple times per second, so I want to limit the http requests to one every 2 seconds during user interaction. I do not want to send an http request when there is no interaction. I am looking to accomplish this using a timer or interval in Angular 2:
onChange() {
if(_interval.timerFinished) {
http.get(.............);
_interval.launchTimer(2000); //2 seconds
}
}
Perhaps I can achieve this by utilizing: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/interval.md