当前位置: 首页>>代码示例>>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;未经允许,请勿转载。