<img src=https://secure.travis-ci.org/'Dominic Tarr'/query-stream.png?branch=master>
create autosuggest widgets with a async function.
create a query stream:
var query = require'query-stream'var qs = query//make request tomake_query_to_whereverquery cb
then, write queries to it:
qswrite'samestuth'//if you change your query it retries the searchqswrite'some stuff'
output chunks will look like this:
//assuming get(q, cb) calls back a string"samestuff not found""CLEAR" //this means new results"stuff1""stuff2"etc
"CLEAR" is a special message.
it means that the following is a new response,
and the display should clear previous elements.
Pipe a input field into this, and out to a list. NOTE, this stuff isn't implemented yet! But it will look something like this:
//input-stream creates a stream of DOM events.inputStream'#query' 'onchange'return evaluepipeqs//element stream adds elements to a given root Element.pipeelementStream'#results'ife === 'CLEAR'return thisrootremoveAllChildrenreturn '<li>'+e+'</li>'## LicenseMIT