0.2.1 • Published 8 years ago

nano-fetch v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

nano-fetch

A tiny window.fetch-like promise-based AJAX implementation

It's based on XMLHttpRequest so refer to its documentation for the expected output. It defaults to JSON output and GET requests.

gzipped size

Usage

nanoFetch('page.php').then(function (jsonResponse) {
	//...
}).catch(function (error) {
	//...
});
nanoFetch('page.php', {
	responseType: 'document',
	method: 'POST'
}).then(function (documentElement) {
	//...
}).catch(function (error) {
	//...
});

With browserify

npm install --save nano-fetch
var nanoFetch = require('nano-fetch');

API

nanoFetch(url[, options])

  • url is an absolute or relative URL
  • options is an object with the properties:

Dependencies

None

License

MIT © Federico Brigante