Documentation changes
martonx opened this issue · comments
Congratulate for bonanza it is good little autocomplete tool. I like it.
Please rewrite your documentation for HTML5 fetch api instead of request. Or I would like to see at least one example with Fetch API usage.
And please clearify in the documentation about the format of response, what bonanza waits (json string, plain js object, url encoded raw string etc...).
What would be the benefit of writing an example with fetch
? I think the examples make it clear how to make it work with fetch
API.
Also, here you have an example of how data should be and how this will be converted to an string.
If you consider this as an important thing, I am open to receive PRs to improve the documentation.
Fetch API is standard requestjs is not. That's it :)
for sure, but the examples are just that: examples. Replacing request
with fetch
is completely trivial:
bonanza(document.querySelector('input'), (query, done) => {
fetch('http://foo/bar?baz=quux')
.then(res => res.json())
.then(res => done(null, res))
.catch(done)
});