本文整理匯總了TypeScript中tinymce/core/api/util/Promise.resolve函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript resolve函數的具體用法?TypeScript resolve怎麽用?TypeScript resolve使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了resolve函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const findSelectedBlob = function (editor) {
let blobInfo;
blobInfo = editor.editorUpload.blobCache.getByUri(getSelectedImage(editor).src);
if (blobInfo) {
return Promise.resolve(blobInfo.blob());
}
return imageToBlob(editor, getSelectedImage(editor));
};
示例2: function
const findBlob = function (editor: Editor, img) {
let blobInfo;
blobInfo = editor.editorUpload.blobCache.getByUri(img.src);
if (blobInfo) {
return Promise.resolve(blobInfo.blob());
}
return imageToBlob(editor, img);
};
示例3: Promise
const waitForLoad = (): Promise<boolean> => {
if (hasLoaded()) {
return Promise.resolve(true);
} else {
return new Promise((resolve, reject) => {
let numRetries = 3;
const interval = Delay.setInterval(() => {
if (hasLoaded()) {
Delay.clearInterval(interval);
resolve(true);
} else {
numRetries--;
if (numRetries < 0) {
console.log('Could not load emojis from url: ' + databaseUrl);
Delay.clearInterval(interval);
reject(false);
}
}
}, 500);
});
}
};
示例4: function
const convertLinkToAbsolute = function (editor, href) {
return !UrlType.isAbsolute(href) && UrlType.isDomainLike(href) ? askAboutPrefix(editor, href) : Promise.resolve(href);
};
示例5:
.then(function (result) {
return result.status < 200 || result.status >= 300 ? Errors.handleHttpError(result.status) : Promise.resolve(result.blob);
});
示例6:
}).then(function (result) {
return result.status < 200 || result.status >= 300 ? Errors.handleServiceErrorResponse(result.status, result.blob) : Promise.resolve(result.blob);
});