From 9669bb7a8f0ba3995dfd4c5c6a61ee1ffe0c0c5b Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Mon, 22 Apr 2024 18:43:09 +0800 Subject: [PATCH 1/2] add for worker type --- 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..737177d2e879 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 +// null: (default) All workers (and in Window) +// 'worker': All workers (and no 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, From 642622b22e0e6bdf7feb7b1298ee7f6f638a4c6d Mon Sep 17 00:00:00 2001 From: Claas Augner <495429+caugner@users.noreply.github.com> Date: Tue, 14 May 2024 15:32:57 +0200 Subject: [PATCH 2/2] Apply suggestions from code review --- kumascript/macros/AvailableInWorkers.ejs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kumascript/macros/AvailableInWorkers.ejs b/kumascript/macros/AvailableInWorkers.ejs index 737177d2e879..9b9f95b6a768 100644 --- a/kumascript/macros/AvailableInWorkers.ejs +++ b/kumascript/macros/AvailableInWorkers.ejs @@ -10,8 +10,8 @@ // '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 in Window) // 'worker': All workers (and no Window) +// null: (default) All workers (and in Window) // // {{AvailableInWorkers}} // {{AvailableInWorkers("worker_except_service")}} @@ -44,7 +44,7 @@ const textDefault = mdn.localString({ 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.`,