mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
2157fd176d
* worker pool * opt * backup * worker and worker backend * worker fallback * opt * opt * remove meta * opt * worker export * testcase fix * worker js template * worker pal * worker opt * test * Replace error messages with error codes * Package size reduction * Package size reduction * revert * Restore editor asset .meta files to the base branch state Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014HAtWwr4dy5azfpccweh1g * bugfix * Split into two features: Worker and Worker Pool * worker option --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
726 B
JavaScript
15 lines
726 B
JavaScript
// Tests switch target at runtime; production selects the same PAL entries via cc.config.json.
|
|
// Only target selection is mocked. All worker behaviour runs the actual distributed PAL code.
|
|
const { minigame } = require('pal/minigame');
|
|
const web = require('../../pal/worker/web/index');
|
|
const mini = require('../../pal/worker/minigame/index');
|
|
const native = require('../../pal/worker/native/index');
|
|
|
|
exports.createWorkerBackend = () => {
|
|
if (['getSystemInfoSync', 'createWorker', 'getFileSystemManager']
|
|
.some((key) => typeof minigame[key] === 'function')) {
|
|
return mini.createWorkerBackend();
|
|
}
|
|
return typeof Worker !== 'undefined' ? web.createWorkerBackend() : native.createWorkerBackend();
|
|
};
|