diff --git a/entry/src/main/ets/workers/MyWorker.ts b/entry/src/main/ets/workers/MyWorker.ts index 9ba3e0f..510eedf 100644 --- a/entry/src/main/ets/workers/MyWorker.ts +++ b/entry/src/main/ets/workers/MyWorker.ts @@ -16,12 +16,6 @@ import worker, { ThreadWorkerGlobalScope, MessageEvents, ErrorEvent } from '@oho var workerPort: ThreadWorkerGlobalScope = worker.workerPort; -/** - * Defines the event handler to be called when the worker thread receives a message sent by the host thread. - * The event handler is executed in the worker thread. - * - * @param e message data - */ workerPort.onmessage = function (e: MessageEvents) { console.log("MyWorker.ts workerPort.onmessage:" + e.data) @@ -29,22 +23,10 @@ workerPort.onmessage = function (e: MessageEvents) { workerPort.postMessage("天天向上") } -/** - * Defines the event handler to be called when the worker receives a message that cannot be deserialized. - * The event handler is executed in the worker thread. - * - * @param e message data - */ workerPort.onmessageerror = function (e: MessageEvents) { console.log("MyWorker.ts workerPort.onmessageerror") } -/** - * Defines the event handler to be called when an exception occurs during worker execution. - * The event handler is executed in the worker thread. - * - * @param e error message - */ workerPort.onerror = function (e: ErrorEvent) { console.log("MyWorker.ts workerPort.onerror") } \ No newline at end of file diff --git a/entry/src/main/ets/workers/PngLoadWorker.ts b/entry/src/main/ets/workers/PngLoadWorker.ts index d9cf419..a4d0178 100644 --- a/entry/src/main/ets/workers/PngLoadWorker.ts +++ b/entry/src/main/ets/workers/PngLoadWorker.ts @@ -17,12 +17,6 @@ import { UPNG } from '@ohos/imageknife/src/main/ets/components/3rd_party/upng/UP var workerPort: ThreadWorkerGlobalScope = worker.workerPort; -/** - * Defines the event handler to be called when the worker thread receives a message sent by the host thread. - * The event handler is executed in the worker thread. - * - * @param e message data - */ workerPort.onmessage = function (e: MessageEvents) { var data = e.data; switch (data.type) { @@ -50,24 +44,4 @@ workerPort.onmessage = function (e: MessageEvents) { default: break } -} - -/** - * Defines the event handler to be called when the worker receives a message that cannot be deserialized. - * The event handler is executed in the worker thread. - * - * @param e message data - */ -workerPort.onmessageerror = function (e: MessageEvents) { - console.log("PngLoadWorker.ts workerPort.onmessageerror: " + e.data) -} - -/** - * Defines the event handler to be called when an exception occurs during worker execution. - * The event handler is executed in the worker thread. - * - * @param e error message - */ -workerPort.onerror = function (e: ErrorEvent) { - console.log("PngLoadWorker.ts workerPort.onerror: " + e.message) } \ No newline at end of file