from http://oyanglul.us
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