Lines Matching refs:worker
3 [Worker](../../arkts-utils/worker-introduction.md) is mainly used to offer applications a multithre…
5 …e blocked. Therefore, you are advised to implement the camera functionalities in the worker thread.
9 1. Create a worker thread file and configure the worker.
11 …worker threads. Right-click any position in the {moduleName} directory and choose **New > Worker**…
16 import { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope, worker } from '@kit.ArkTS';
19 const workerPort: ThreadWorkerGlobalScope = worker.workerPort;
25 …worker thread cannot use getContext() to obtain the context of the host thread. Instead, the conte…
31 console.info(`worker onmessage type:${messageInfo.type}`)
33 // The worker thread receives a camera initialization message from the host thread.
34 console.info(`worker initCamera surfaceId:${messageInfo.surfaceId}`)
35 // Initialize the camera in the worker thread.
38 // The worker thread receives a camera release message from the host thread.
39 console.info('worker releaseCamera.');
40 // Release the camera in the worker thread.
157 …instance in the page-related lifecycle, and initialize and release the camera in the worker thread.
160 import { worker } from '@kit.ArkTS';
169 // Create a ThreadWorker object to obtain a worker instance.
170 …private workerInstance: worker.ThreadWorker = new worker.ThreadWorker('entry/ets/workers/CameraWor…
174 … // Send a message to the worker thread through the worker instance to initialize the camera.
184 // Send a message to the worker thread through the worker instance to destroy the camera.
209 console.error('create stage worker failed');
212 // The host thread sends a camera initialization message to the worker thread.
215 … context: getContext(this), // Pass the context of the host thread to the worker thread.
216 surfaceId: this.surfaceId, // Pass the surface ID to the worker thread.
243 