Created
January 11, 2014 17:06
-
-
Save silppuri/8373567 to your computer and use it in GitHub Desktop.
This file contains 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 submitStream = $('#search-form').asEventStream('submit'); | |
submitStream.doAction(".preventDefault") | |
.flatMapLatest(function (e) { | |
var searchString = $(e.target).children('#search').val() | |
if (searchString !== "") { | |
return Bacon.constant(searchString); | |
} else { | |
return Bacon.never(); | |
} | |
}) | |
.skipDuplicates() | |
.onValue(function (e) { | |
console.log(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment