本文整理汇总了TypeScript中core/utils/collections.buildQueryString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript buildQueryString函数的具体用法?TypeScript buildQueryString怎么用?TypeScript buildQueryString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buildQueryString函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
return function(data : any, callback : Function) {
var scheme = "http" + (useTLS ? "s" : "") + "://";
var url = scheme + (sender.host || sender.options.host) + sender.options.path;
var query = Collections.buildQueryString(data);
url += ("/" + 2 + "?" + query);
var xhr = Runtime.createXHR();
xhr.open("GET", url, true);
xhr.onreadystatechange = function(){
if (xhr.readyState === 4) {
let {status, responseText} = xhr;
if (status !== 200) {
Logger.debug(`TimelineSender Error: received ${status} from stats.pusher.com`);
return;
}
try {
var {host} = JSON.parse(responseText);
} catch(e) {
Logger.debug(`TimelineSenderError: invalid response ${responseText}`);
}
if (host) {
sender.host = host;
}
}
}
xhr.send();
}
示例2: send
/** Sends the actual JSONP request.
*
* @param {ScriptReceiver} receiver
*/
send(receiver : ScriptReceiver) {
if (this.request) {
return;
}
var query = Collections.buildQueryString(this.data);
var url = this.url + "/" + receiver.number + "?" + query;
this.request = Runtime.createScriptRequest(url);
this.request.send(receiver);
}
示例3: function
return function(data : any, callback : Function) {
var scheme = "http" + (useTLS ? "s" : "") + "://";
var url = scheme + (sender.host || sender.options.host) + sender.options.path;
var query = Collections.buildQueryString(data);
url += ("/" + 2 + "?" + query);
fetch(url).
then((response) => {
if (response.status !== 200) {
throw(`received ${response.status} from stats.pusher.com`)
}
return response.json();
}).then(({host})=>{
if (host) {
sender.host = host;
}
}).catch((err)=> {
Logger.debug("TimelineSender Error: ", err);
});
}