diff --git a/kumascript/macros/AvailableInWorkers.ejs b/kumascript/macros/AvailableInWorkers.ejs index 91594a80174c..155d35e78bef 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")}} @@ -65,6 +70,11 @@ 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.`, + "zh-CN": `此特性在 Web Worker(不包括专用 Web Worker)中可用。`, +}); + const textNotServiceNotWindow = mdn.localString({ "de": `Dieses Feature ist nur verfügbar in Web Workers, außer in Service Workers.`, "en-US": `This feature is only available in Web Workers, except for Service Workers.`, @@ -72,18 +82,14 @@ const textNotServiceNotWindow = mdn.localString({ "zh-CN": `此特性仅在 Web Worker(不包括 Service Worker)中可用。`, }); -const textDedicated = mdn.localString({ - "de": `Dieses Feature ist verfügbar in Dedicated Web Workers.`, - "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.`, + "zh-CN": `此特性仅在 Web Worker(不包括共享 Web Worker)中可用。`, }); -const textDedicatedOnly = mdn.localString({ - "de": `Dieses Feature ist nur verfügbar in Dedicated Web Workers.`, - "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.`, + "zh-CN": `此特性仅在 Web Worker(不包括专用 Web Worker)中可用。`, }); const textService = mdn.localString({ @@ -93,6 +99,18 @@ const textService = mdn.localString({ "zh-CN": `此特性在 Service Worker 中可用。`, }); +const textShared = mdn.localString({ + "en-US": `This feature is available in Shared Web Workers.`, + "zh-CN": `此特性在共享 Web Worker 中可用。`, +}); + +const textDedicated = mdn.localString({ + "de": `Dieses Feature ist verfügbar in Dedicated Web Workers.`, + "en-US": `This feature is available in Dedicated Web Workers.`, + "ja": `この機能は専用ウェブワーカー内で利用可能です。`, + "zh-CN": `此特性在专用 Web Worker中可用。`, +}); + const textServiceOnly = mdn.localString({ "de": `Dieses Feature ist nur verfügbar in Service Workers.`, "en-US": `This feature is only available in Service Workers.`, @@ -100,6 +118,18 @@ const textServiceOnly = mdn.localString({ "zh-CN": `此特性仅在 Service Worker 中可用。`, }) +const textSharedOnly = mdn.localString({ + "en-US": `This feature is only available in Shared Web Workers.`, + "zh-CN": `此特性仅在共享 Web Worker 中可用。`, +}) + +const textDedicatedOnly = mdn.localString({ + "de": `Dieses Feature ist nur verfügbar in Dedicated Web Workers.`, + "en-US": `This feature is only available in Dedicated Web Workers.`, + "ja": `この機能は専用ウェブワーカー内でのみ利用可能です。`, + "zh-CN": `此特性仅在专用 Web Worker 中可用。`, +}); + const workerType = $0 || 'default'; const associatedText = { @@ -107,11 +137,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]) {