当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript XHR.send函数代码示例

本文整理汇总了TypeScript中tinymce/core/util/XHR.send函数的典型用法代码示例。如果您正苦于以下问题:TypeScript send函数的具体用法?TypeScript send怎么用?TypeScript send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了send函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

 suite.asyncTest('Unsuccessful request', function (_, done) {
   XHR.send({
     url: '/custom/404',
     error (type, xhr, input) {
       LegacyUnit.equal(type, 'GENERAL');
       LegacyUnit.equal(xhr.status, 404);
       LegacyUnit.equal(input.url, '/custom/404');
       done();
     }
   });
 });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:11,代码来源:XhrTest.ts

示例2: function

const createImageList = function (editor, callback) {
  const imageList = Settings.getImageList(editor);

  if (typeof imageList === 'string') {
    XHR.send({
      url: imageList,
      success (text) {
        callback(JSON.parse(text));
      }
    });
  } else if (typeof imageList === 'function') {
    imageList(callback);
  } else {
    callback(imageList);
  }
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:16,代码来源:Utils.ts

示例3: function

const createLinkList = function (editor, callback) {
  const linkList = Settings.getLinkList(editor.settings);

  if (typeof linkList === 'string') {
    XHR.send({
      url: linkList,
      success (text) {
        callback(editor, JSON.parse(text));
      }
    });
  } else if (typeof linkList === 'function') {
    linkList(function (list) {
      callback(editor, list);
    });
  } else {
    callback(editor, linkList);
  }
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:18,代码来源:Dialog.ts

示例4: function

  const onSelectTemplate = function (e) {
    const value = e.control.value();

    if (value.url) {
      XHR.send({
        url: value.url,
        success (html) {
          templateHtml = html;
          insertIframeHtml(editor, win, templateHtml);
        }
      });
    } else {
      templateHtml = value.content;
      insertIframeHtml(editor, win, templateHtml);
    }

    win.find('#description')[0].text(e.control.value().description);
  };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:18,代码来源:Dialog.ts

示例5: function

  return function () {
    const templateList = Settings.getTemplates(editorSettings);

    if (typeof templateList === 'function') {
      templateList(callback);
      return;
    }

    if (typeof templateList === 'string') {
      XHR.send({
        url: templateList,
        success (text) {
          callback(JSON.parse(text));
        }
      });
    } else {
      callback(templateList);
    }
  };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:19,代码来源:Templates.ts

示例6: function

  return function (method, text, doneCallback, errorCallback) {
    const data = { method, lang: currentLanguageState.get() };
    let postData = '';

    data[method === 'addToDictionary' ? 'word' : 'text'] = text;

    Tools.each(data, function (value, key) {
      if (postData) {
        postData += '&';
      }

      postData += key + '=' + encodeURIComponent(value);
    });

    XHR.send({
      url: new URI(pluginUrl).toAbsolute(Settings.getRpcUrl(editor)),
      type: 'post',
      content_type: 'application/x-www-form-urlencoded',
      data: postData,
      success (result) {
        result = JSON.parse(result);

        if (!result) {
          const message = editor.translate('Server response wasn\'t proper JSON.');
          errorCallback(message);
        } else if (result.error) {
          errorCallback(result.error);
        } else {
          doneCallback(result);
        }
      },
      error () {
        const message = editor.translate('The spelling service was not found: (') +
          Settings.getRpcUrl(editor) +
          editor.translate(')');
        errorCallback(message);
      }
    });
  };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:39,代码来源:Actions.ts


注:本文中的tinymce/core/util/XHR.send函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。