I'm trying to create something like isTyping or not, so I have to detect when user stop type more or less 3 seconds, so I can do my stuff, I allready detected when he's typing using this :
ngOnChanges(searchValue: string) {
if (!this.searchChangeObserver) {
Observable.create(observer => {
this.searchChangeObserver = observer;
}).debounceTime(3000)
.subscribe((data) => {
if (data) {
typingStuff();
}
else {
notTypingStuff();
}
});
this.searchChangeObserver.next(searchValue);
}
}
}
So now I have to detect when user stops typing to do the notTypingStuff();
Is there a simple way to do it?
EDIT
I'm also using this :
constructor(){
this.modelChanged
.debounceTime(300)
.subscribe((data) => {
if (data) {
typingStuff();
}
else {
notTypingStuff();
}
});
}
But should know when user stops to type in 3 seconds to do the notTypingStuff() as well..