mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 21:46:35 +00:00
fix: resolve loading image error
This commit is contained in:
@@ -33,17 +33,15 @@
|
|||||||
if (isInfo) {
|
if (isInfo) {
|
||||||
status = 'loaded';
|
status = 'loaded';
|
||||||
} else {
|
} else {
|
||||||
await apply();
|
await runTool();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showError(e);
|
showError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function apply() {
|
async function runTool() {
|
||||||
if (!source || isInfo || status === 'processing') return;
|
if (!source || isInfo) return;
|
||||||
errorText = '';
|
|
||||||
status = 'processing';
|
|
||||||
try {
|
try {
|
||||||
result = await tool.run(source, values);
|
result = await tool.run(source, values);
|
||||||
status = 'loaded';
|
status = 'loaded';
|
||||||
@@ -52,6 +50,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function apply() {
|
||||||
|
if (!source || isInfo || status === 'processing') return;
|
||||||
|
errorText = '';
|
||||||
|
status = 'processing';
|
||||||
|
runTool();
|
||||||
|
}
|
||||||
|
|
||||||
function showError(e: unknown) {
|
function showError(e: unknown) {
|
||||||
status = source ? 'loaded' : 'idle';
|
status = source ? 'loaded' : 'idle';
|
||||||
errorText = e instanceof Error ? e.message : String(e);
|
errorText = e instanceof Error ? e.message : String(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user