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


TypeScript xhr-request類代碼示例

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


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

示例1: callQuery

 callQuery(query: string, callback: (error?: Error, json?: any) => void) {
   var url = `${appInsightsUri}/${this.appId}/query`; 
   try {
     request(
       url, 
       {
         method: 'POST',
         json: true,
         headers: {
           'x-api-key': this.apiKey
         },
         body: { query }
       }, 
       (error: Error, json: any) => {
         if (error) {
           callback(error);
         }
       
         callback(null, json);
       }
     );
   } catch (ex) {
     callback(ex);
   }
 }
開發者ID:kishoreBhojan,項目名稱:ibex-dashboard,代碼行數:25,代碼來源:ApplicationInsightsApi.ts

示例2: dispatcher

    return (dispatcher: (json: any) => void) => {

      // Replace both 'id' and 'url' with the requested id from the user
      const idRegExPattern = /id: \".*\",/i;
      const urlRegExPatternt = /url: \".*\",/i;
      const updatedContent =
        content.replace(idRegExPattern, 'id: \"' + dashboardId + '\",')
               .replace(urlRegExPatternt, 'url: \"' + dashboardId + '\",');

      request(
        '/api/dashboards/' + dashboardId,
        {
          method: 'PUT',
          json: true,
          body: { script: updatedContent }
        },
        (error: any, json: any) => {
          if (error || (json && json.errors)) {
            return this.failure(error || json.errors);
          }
          
          // redirect to the newly imported dashboard
          window.location.replace('dashboard/' + dashboardId);
          return dispatcher(json);
        }
      );
    };
開發者ID:kishoreBhojan,項目名稱:ibex-dashboard,代碼行數:27,代碼來源:ConfigurationsActions.ts

示例3: request

              (setupError: any, setupJson: any) => {

          if (setupError) {
            return this.failure(setupError);
          }

          return request('/auth/init', 
                         (authError: any, authJson: any) => {

              if (authError) {
                return this.failure(authError);
              }

              let toast: IToast = { text: 'Setup was saved successfully.' };
              ToastActions.addToast(toast);

              try {
                if (successCallback) {
                  successCallback();
                }
              } catch (e) { }

              return dispatcher(authJson);
            }
          );
        }
開發者ID:kishoreBhojan,項目名稱:ibex-dashboard,代碼行數:26,代碼來源:SetupActions.ts

示例4: dispatch

 return (dispatch) => {
   request('/api/dashboards/' + dashboardId + '?format=raw', {}, function (err: any, data: any) {
     if (err) {
       throw err;
     }
     return dispatch( data );
   });
 };
開發者ID:kishoreBhojan,項目名稱:ibex-dashboard,代碼行數:8,代碼來源:EditorActions.ts

示例5: dispatcher

    return (dispatcher: (account: IDictionary) => void) => {

      request('/auth/account', { json: true }, (error: any, result: any) => {
          if (error || result && result.error) {
            return this.failure(error || result && result.error);
          }
          return dispatcher({ account: result.account });
        }
      );

    };
開發者ID:kishoreBhojan,項目名稱:ibex-dashboard,代碼行數:11,代碼來源:AccountActions.ts

示例6: request

    return (dispatcher: (result: { template: IDashboardConfig }) => void) => {
      let script = utils.objectToString(template);
      
      script = '/// <reference path="../../../client/@types/types.d.ts"/>\n' +
              'import * as _ from \'lodash\';\n\n' +
              'export const config: IDashboardConfig = /*return*/ ' + script;
      return request(
        '/api/templates/' + template.id, 
        {
          method: 'PUT',
          json: true,
          body: { script: script }
        }, 
        (error: any, json: any) => {

          if (error || (json && json.errors)) {
            return this.failure(error || json.errors);
          }

          return dispatcher(json);
        }
      );
    };
開發者ID:kishoreBhojan,項目名稱:ibex-dashboard,代碼行數:23,代碼來源:ConfigurationsActions.ts


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