[gist]moz-request.js

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
    原文作者:oyanglulu
    原文地址: https://segmentfault.com/a/1190000000638866
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞