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


TypeScript logger.warn函數代碼示例

本文整理匯總了TypeScript中core/logger.warn函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript warn函數的具體用法?TypeScript warn怎麽用?TypeScript warn使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了warn函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

var jsonp : AuthTransport = function(context : Browser, socketId, callback){
  if(this.authOptions.headers !== undefined) {
    Logger.warn("Warn", "To send headers with the auth request, you must use AJAX, rather than JSONP.");
  }

  var callbackName = context.nextAuthCallbackID.toString();
  context.nextAuthCallbackID++;

  var document = context.getDocument();
  var script = document.createElement("script");
  // Hacked wrapper.
  context.auth_callbacks[callbackName] = function(data) {
    callback(false, data);
  };

  var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  script.src = this.options.authEndpoint +
    '?callback=' +
    encodeURIComponent(callback_name) +
    '&' +
    this.composeQuery(socketId);

  var head = document.getElementsByTagName("head")[0] || document.documentElement;
  head.insertBefore( script, head.firstChild );
};
開發者ID:Nabobil,項目名稱:pusher-js,代碼行數:25,代碼來源:jsonp_auth.ts

示例2: function

  xhr.onreadystatechange = function() {
    if (xhr.readyState === 4) {
      if (xhr.status === 200) {
        var data, parsed = false;

        try {
          data = JSON.parse(xhr.responseText);
          parsed = true;
        } catch (e) {
          callback(true, 'JSON returned from webapp was invalid, yet status code was 200. Data was: ' + xhr.responseText);
        }

        if (parsed) { // prevents double execution.
          callback(false, data);
        }
      } else {
        var suffix = UrlStore.buildLogSuffix("authenticationEndpoint");
        Logger.warn(
          `Couldn't retrieve authentication info. ${xhr.status}` +
          `Clients must be authenticated to join private or presence channels. ${suffix}`
        );
        callback(true, xhr.status);
      }
    }
  };
開發者ID:pusher,項目名稱:pusher-js,代碼行數:25,代碼來源:xhr_auth.ts

示例3: fetch

 return fetch(request).then((response)=>{
   let {status} = response;
   if (status === 200) {
     return response.text();
   } else {
     Logger.warn("Couldn't get auth info from your webapp", status);
     throw status;
   }
 }).then((data)=>{
開發者ID:pusher,項目名稱:pusher-js,代碼行數:9,代碼來源:fetch_auth.ts

示例4: catch

 }).then((data)=>{
   try {
     data = JSON.parse(data);
   } catch (e) {
     var message = 'JSON returned from webapp was invalid, yet status code was 200. Data was: ' + data;
     Logger.warn(message);
     throw message;
   }
   callback(false, data);
 }).catch((err)=>{
開發者ID:pusher,項目名稱:pusher-js,代碼行數:10,代碼來源:fetch_auth.ts

示例5: function

  xhr.onreadystatechange = function() {
    if (xhr.readyState === 4) {
      if (xhr.status === 200) {
        var data, parsed = false;

        try {
          data = JSON.parse(xhr.responseText);
          parsed = true;
        } catch (e) {
          callback(true, 'JSON returned from webapp was invalid, yet status code was 200. Data was: ' + xhr.responseText);
        }

        if (parsed) { // prevents double execution.
          callback(false, data);
        }
      } else {
        Logger.warn("Couldn't get auth info from your webapp", xhr.status);
        callback(true, xhr.status);
      }
    }
  };
開發者ID:Nabobil,項目名稱:pusher-js,代碼行數:21,代碼來源:xhr_auth.ts


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