Skip to content

Commit d56a76f

Browse files
enhance(macros/AvailableInWorkers): add "only available in Web Workers" case (#10968)
1 parent 45254aa commit d56a76f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: kumascript/macros/AvailableInWorkers.ejs

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
// 'window_and_worker_except_service': all workers but ServiceWorker (and in Window)
1010
// 'worker_except_service': all workers but ServiceWorker (and no window)
1111
// 'window_and_service': only in ServiceWorker (and in Window)
12-
// 'service': only in ServiceWorker
13-
// null: (default) All workers (and Window)
12+
// 'service': only in ServiceWorker
13+
// 'worker': All workers (and no Window)
14+
// null: (default) All workers (and in Window)
1415
//
1516
// {{AvailableInWorkers}}
1617
// {{AvailableInWorkers("worker_except_service")}}
@@ -40,6 +41,11 @@ const textDefault = mdn.localString({
4041
"ru": `Эта возможность доступна в <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
4142
});
4243
44+
const textWorker = mdn.localString({
45+
"en-US": `This feature is only available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
46+
"zh-CN": `此特性仅在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a> 中可用。`,
47+
});
48+
4349
const textNotService = mdn.localString({
4450
"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>.`,
4551
"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>)中可用。`,
@@ -75,6 +81,7 @@ const workerType = $0 || 'default';
7581
7682
const associatedText = {
7783
default: () => textDefault,
84+
worker: () => textWorker,
7885
window_and_worker_except_service: () => textNotService,
7986
worker_except_service: () => textNotServiceNotWindow,
8087
window_and_dedicated: () => textDedicated,

0 commit comments

Comments
 (0)