本文整理匯總了TypeScript中@ephox/imagetools.ResultConversions類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ResultConversions類的具體用法?TypeScript ResultConversions怎麽用?TypeScript ResultConversions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ResultConversions類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
return function () {
const state = tempState || currentState;
ResultConversions.blobToImageResult(state.blob).
then(function (ir) {
fn.apply(this, [ir].concat(args)).then(imageResultToBlob).then(addTempState);
});
};
示例2: update
function update(value) {
ResultConversions.blobToImageResult(currentState.blob).
then(function (ir) {
return filter(ir, value);
}).
then(imageResultToBlob).
then(function (blob) {
const newTempState = createState(blob);
displayState(newTempState);
destroyState(tempState);
tempState = newTempState;
});
}
示例3: crop
function crop() {
const rect = imagePanel.selection();
ResultConversions.blobToImageResult(currentState.blob).
then(function (ir) {
ImageTransformations.crop(ir, rect.x, rect.y, rect.w, rect.h).
then(imageResultToBlob).
then(function (blob) {
addBlobState(blob);
cancel();
});
});
}
示例4: block
const blobManipulate = (anyInSystem: AlloyComponent, blob: Blob, filter: (ir: ImageResult) => ImageResult | PromiseLike<ImageResult>, action: (blob: Blob) => string, swap: () => void): Promise<Option<Element>> => {
block(anyInSystem);
return ResultConversions.blobToImageResult(blob).
then(filter).
then(imageResultToBlob).
then(action).
then((url) => {
return updateSrc(anyInSystem, url).then((oImg) => {
updateButtonUndoStates(anyInSystem);
swap();
unblock(anyInSystem);
return oImg;
});
}).catch((err) => {
console.log(err); // TODO: Notify the user?
unblock(anyInSystem);
return err;
});
};