Skip to content

Commit

Permalink
enhance(macros/AvailableInWorkers): add "only available in Web Worker…
Browse files Browse the repository at this point in the history
…s" case (#10968)
  • Loading branch information
skyclouds2001 authored May 14, 2024
1 parent 45254aa commit d56a76f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions kumascript/macros/AvailableInWorkers.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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")}}
Expand Down Expand Up @@ -40,6 +41,11 @@ const textDefault = mdn.localString({
"ru": `Эта возможность доступна в <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
});
const textWorker = mdn.localString({
"en-US": `This feature is only available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
"zh-CN": `此特性仅在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a> 中可用。`,
});
const textNotService = mdn.localString({
"en-US": `This feature is available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>, except for <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"zh-CN": `此特性在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a>(不包括 <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Worker</a>)中可用。`,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d56a76f

Please sign in to comment.