From d56a76fabb6f6452a2ddfd472c889103c30faf2c Mon Sep 17 00:00:00 2001 From: skyclouds2001 <95597335+skyclouds2001@users.noreply.github.com> Date: Tue, 14 May 2024 21:36:56 +0800 Subject: [PATCH] enhance(macros/AvailableInWorkers): add "only available in Web Workers" case (#10968) --- kumascript/macros/AvailableInWorkers.ejs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kumascript/macros/AvailableInWorkers.ejs b/kumascript/macros/AvailableInWorkers.ejs index 79bf3f2c4730..9b9f95b6a768 100644 --- a/kumascript/macros/AvailableInWorkers.ejs +++ b/kumascript/macros/AvailableInWorkers.ejs @@ -9,8 +9,9 @@ // 'window_and_worker_except_service': all workers but ServiceWorker (and in Window) // 'worker_except_service': all workers but ServiceWorker (and no window) // 'window_and_service': only in ServiceWorker (and in Window) -// 'service': only in ServiceWorker -// null: (default) All workers (and Window) +// 'service': only in ServiceWorker +// 'worker': All workers (and no Window) +// null: (default) All workers (and in Window) // // {{AvailableInWorkers}} // {{AvailableInWorkers("worker_except_service")}} @@ -40,6 +41,11 @@ const textDefault = mdn.localString({ "ru": `Эта возможность доступна в Web Workers.`, }); +const textWorker = mdn.localString({ + "en-US": `This feature is only available in Web Workers.`, + "zh-CN": `此特性仅在 Web Worker 中可用。`, +}); + const textNotService = mdn.localString({ "en-US": `This feature is available in Web Workers, except for Service Workers.`, "zh-CN": `此特性在 Web Worker(不包括 Service Worker)中可用。`, @@ -75,6 +81,7 @@ const workerType = $0 || 'default'; const associatedText = { default: () => textDefault, + worker: () => textWorker, window_and_worker_except_service: () => textNotService, worker_except_service: () => textNotServiceNotWindow, window_and_dedicated: () => textDedicated,