😪 js-standard

This commit is contained in:
zuiidea
2017-01-03 16:15:38 +08:00
parent 49d700a5c8
commit 87af30c4b6
50 changed files with 783 additions and 858 deletions
+6 -8
View File
@@ -1,4 +1,4 @@
const Ajax = require("robe-ajax")
const Ajax = require('robe-ajax')
/**
* Requests a URL, returning a promise.
@@ -7,20 +7,18 @@ const Ajax = require("robe-ajax")
* @param {object} [options] The options we want to pass to "fetch"
* @return {object} An object containing either "data" or "err"
*/
export default function request(url, options) {
export default function request (url, options) {
if (options.cross) {
return Ajax.getJSON("http://query.yahooapis.com/v1/public/yql", {
q: "select * from json where url=\'"+url+"?"+Ajax.param(options.data)+"\'",
format: "json"
return Ajax.getJSON('http://query.yahooapis.com/v1/public/yql', {
q: "select * from json where url='" + url + '?' + Ajax.param(options.data) + "'",
format: 'json'
})
} else {
return Ajax.ajax({
url: url,
method: options.method || 'get',
data: options.data || {},
processData: options.method == 'get'
? true
: false,
processData: options.method === 'get',
dataType: 'JSON'
}).done((data) => {
return data