Skip to content

Commit

Permalink
fix example progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
leyhline committed Jun 24, 2023
1 parent 780b282 commit cfc5b8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ try {
worker = await MecabWorker.create(
{ url: "../ipadic-2.7.0_bin.zip", cacheName: "ipadic-2.7.0_bin" },
(message) => {
console.log(message);
if (message.total) {
size += message.size;
progressElement.value = message.size;
progressElement.value = size;
progressElement.max = message.total;
} else {
progressElement.removeAttribute("value");
Expand All @@ -33,9 +32,11 @@ try {
}
);
progressElement.value = 1;
progressElement.max = 1;
} catch (error) {
appendToLog(error);
progressElement.value = 0;
progressElement.max = 1;
throw error;
}

Expand Down

0 comments on commit cfc5b8a

Please sign in to comment.