Skip to content

Instantly share code, notes, and snippets.

@jcouyang
Last active August 29, 2015 14:05
Show Gist options
  • Save jcouyang/6365feec88bf86a4ae59 to your computer and use it in GitHub Desktop.
Save jcouyang/6365feec88bf86a4ae59 to your computer and use it in GitHub Desktop.
var Request = require("sdk/request").Request;
var request = function(url, method, data){
var res = $.Deferred();
Request({
url: url,
content: data,
onComplete: function (response) {
res.resovle(response.json);
}
})[method]();
return res;
}
module.exports = request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment