當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript collections.buildQueryString函數代碼示例

本文整理匯總了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();
  }
開發者ID:pusher,項目名稱:pusher-js,代碼行數:31,代碼來源:xhr_timeline.ts

示例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);
   }
開發者ID:Nabobil,項目名稱:pusher-js,代碼行數:14,代碼來源:jsonp_request.ts

示例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);
      });
  }
開發者ID:pusher,項目名稱:pusher-js,代碼行數:20,代碼來源:fetch_timeline.ts


注:本文中的core/utils/collections.buildQueryString函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。