Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "xhr-tool", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "XMLHttpRequest with Promises", | ||
@@ -5,0 +5,0 @@ "keywords": [ "xhr", "promises", "es6" ], |
@@ -5,2 +5,14 @@ # xhr-tool | ||
[![Dependencies](https://david-dm.org/JannesMeyer/xhr-tool.svg)](https://david-dm.org/JannesMeyer/xhr-tool) | ||
[![Development Dependencies](https://david-dm.org/JannesMeyer/xhr-tool/dev-status.svg)](https://david-dm.org/JannesMeyer/xhr-tool#info=devDependencies) | ||
[![Development Dependencies](https://david-dm.org/JannesMeyer/xhr-tool/dev-status.svg)](https://david-dm.org/JannesMeyer/xhr-tool#info=devDependencies) | ||
**Import the function** | ||
~~~js | ||
var getJSON = require('xhr-tool').getJSON; | ||
~~~ | ||
## getJSON | ||
getJSON(url) → Promise → Object | ||
Sends an asynchronous request and returns a Promise for the parsed JSON response |
/** | ||
* Sends an asynchronous JSON request | ||
* Sends an asynchronous request and returns a Promise for the parsed JSON response | ||
*/ | ||
function getJSON(url, callback) { | ||
function getJSON(url) { | ||
var res = Promise.defer(); | ||
@@ -6,0 +6,0 @@ var req = new XMLHttpRequest(); |
2050
18