forked from floraachy/ImageKnife
parent
0f16d4437a
commit
bb801643d4
|
@ -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")
|
||||
}
|
|
@ -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)
|
||||
}
|
Loading…
Reference in New Issue