Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(macros/AvailableInWorkers): add "only available in Web Workers" case #10968

Merged
merged 4 commits into from
May 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
// null: (default) All workers (and in Window)
// 'worker': All workers (and no Window)
caugner marked this conversation as resolved.
Show resolved Hide resolved
//
// {{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> 中可用。`,
})
caugner marked this conversation as resolved.
Show resolved Hide resolved

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