diff --git a/kumascript/macros/AvailableInWorkers.ejs b/kumascript/macros/AvailableInWorkers.ejs index 9d49f9e7a58c..367e313c8050 100644 --- a/kumascript/macros/AvailableInWorkers.ejs +++ b/kumascript/macros/AvailableInWorkers.ejs @@ -4,15 +4,20 @@ // Parameters: // // $0 - workerType (optional): -// 'window_and_dedicated': only in DedicatedWorker (and in Window) -// 'dedicated': only in DedicatedWorker +// null: (default) All workers (and in Window) +// 'worker': All workers (and no Window) // 'window_and_worker_except_service': all workers but ServiceWorker (and in Window) -// 'window_and_worker_except_shared': all workers but shared workers (and in Window) +// 'window_and_worker_except_shared': all workers but SharedWorker (and in Window) +// 'window_and_worker_except_dedicated': all workers but DedicatedWorker (and in Window) // 'worker_except_service': all workers but ServiceWorker (and no window) +// 'worker_except_shared': all workers but SharedWorker (and no window) +// 'worker_except_dedicated': all workers but DedicatedWorker (and no window) // 'window_and_service': only in ServiceWorker (and in Window) -// 'service': only in ServiceWorker -// 'worker': All workers (and no Window) -// null: (default) All workers (and in Window) +// 'window_and_shared': only in ServiceWorker (and in Window) +// 'window_and_dedicated': only in DedicatedWorker (and in Window) +// 'service': only in ServiceWorker (and no window) +// 'shared': only in SharedWorker (and no window) +// 'dedicated': only in DedicatedWorker (and no window) // // {{AvailableInWorkers}} // {{AvailableInWorkers("worker_except_service")}} @@ -60,22 +65,22 @@ const textNotShared = mdn.localString({ "zh-CN": `此特性在 Web Worker(不包括共享 Web Worker)中可用。`, }); +const textNotDedicated = mdn.localString({ + "en-US": `This feature is available in Web Workers, except for Dedicated Web Workers.`, +}); + const textNotServiceNotWindow = mdn.localString({ "en-US": `This feature is only available in Web Workers, except for Service Workers.`, "ja": `この機能はウェブワーカー内でのみ利用可能ですが、サービスワーカーでは使用できません。`, "zh-CN": `此特性仅在 Web Worker(不包括 Service Worker)中可用。`, }); -const textDedicated = mdn.localString({ - "en-US": `This feature is available in Dedicated Web Workers.`, - "ja": `この機能は専用ウェブワーカー内で利用可能です。`, - "zh-CN": `此特性在专用 Web Worker中可用。`, +const textNotSharedNotWindow = mdn.localString({ + "en-US": `This feature is only available in Web Workers, except for Shared Web Workers.`, }); -const textDedicatedOnly = mdn.localString({ - "en-US": `This feature is only available in Dedicated Web Workers.`, - "ja": `この機能は専用ウェブワーカー内でのみ利用可能です。`, - "zh-CN": `此特性仅在专用 Web Worker 中可用。`, +const textNotDedicatedNotWindow = mdn.localString({ + "en-US": `This feature is only available in Web Workers, except for Dedicated Web Workers.`, }); const textService = mdn.localString({ @@ -84,12 +89,32 @@ const textService = mdn.localString({ "zh-CN": `此特性在 Service Worker 中可用。`, }); +const textShared = mdn.localString({ + "en-US": `This feature is available in Shared Web Workers.`, +}); + +const textDedicated = mdn.localString({ + "en-US": `This feature is available in Dedicated Web Workers.`, + "ja": `この機能は専用ウェブワーカー内で利用可能です。`, + "zh-CN": `此特性在专用 Web Worker中可用。`, +}); + const textServiceOnly = mdn.localString({ "en-US": `This feature is only available in Service Workers.`, "ja": `この機能はサービスワーカー内でのみ利用可能です。`, "zh-CN": `此特性仅在 Service Worker 中可用。`, }) +const textSharedOnly = mdn.localString({ + "en-US": `This feature is only available in Shared Web Workers.`, +}) + +const textDedicatedOnly = mdn.localString({ + "en-US": `This feature is only available in Dedicated Web Workers.`, + "ja": `この機能は専用ウェブワーカー内でのみ利用可能です。`, + "zh-CN": `此特性仅在专用 Web Worker 中可用。`, +}); + const workerType = $0 || 'default'; const associatedText = { @@ -97,11 +122,16 @@ const associatedText = { worker: () => textWorker, window_and_worker_except_service: () => textNotService, window_and_worker_except_shared: () => textNotShared, + window_and_worker_except_dedicated: () => textNotDedicated, worker_except_service: () => textNotServiceNotWindow, - window_and_dedicated: () => textDedicated, - dedicated: () => textDedicatedOnly, + worker_except_shared: () => textNotSharedNotWindow, + worker_except_dedicated: () => textNotDedicatedNotWindow, window_and_service: () => textService, + window_and_shared: () => textShared, + window_and_dedicated: () => textDedicated, service: () => textServiceOnly, + shared: () => textSharedOnly, + dedicated: () => textDedicatedOnly, }; if (!associatedText[workerType]) {