Spent too much time trying to fix main thread offload crash
This commit is contained in:
@@ -8,20 +8,9 @@ parentPort.on("message", async (data) => {
|
||||
const creator = new NameCardCreator(templatePath);
|
||||
const buffer = await creator.getWelcomeCard(avatarURL, username);
|
||||
|
||||
parentPort.postMessage({ result: buffer });
|
||||
parentPort.postMessage({ result: buffer }, [buffer.buffer]);
|
||||
|
||||
} catch (err) {
|
||||
parentPort.postMessage({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
/*(async () => {
|
||||
try {
|
||||
const { creator, avatarURL, userName } = workerData;
|
||||
|
||||
const buffer = await creator.getWelcomeCard(avatarURL, userName);
|
||||
|
||||
parentPort.postMessage(buffer); // return the buffer to main thread
|
||||
} catch (err) {
|
||||
parentPort.postMessage({ error: err.message });
|
||||
}
|
||||
})();*/
|
||||
});
|
||||
Reference in New Issue
Block a user