Created
July 3, 2017 05:54
-
-
Save lvidal1/42bc3e735ad40a16091ac381683e821f to your computer and use it in GitHub Desktop.
Debounce on typing with Rxjs (pluck operator)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var input = document.querySelector('input'); | |
var observable = Rx.Observable.fromEvent(input,'input'); | |
observable | |
.pluck('target','value') // nested attributes from event | |
.filter((v)=> v.length > 0) | |
.debounceTime(500) | |
.distinctUntilChanged() | |
.subscribe({ | |
next: function(e){ | |
console.log( | |
e); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment