本文整理汇总了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();
}
});
});
示例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);
}
};
示例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);
}
};
示例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);
};
示例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);
}
};
示例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);
}
});
};