Fix top-level await

This commit is contained in:
Lim Chee Aun 2025-03-03 11:00:15 +08:00
parent d605f4caca
commit 0b29b3dabd

View file

@ -4,6 +4,7 @@ export const supportsBrowserTranslator =
// https://developer.chrome.com/docs/ai/language-detection // https://developer.chrome.com/docs/ai/language-detection
export let langDetector; export let langDetector;
if (supportsBrowserTranslator) { if (supportsBrowserTranslator) {
(async () => {
try { try {
const languageDetectorCapabilities = const languageDetectorCapabilities =
await self.ai.languageDetector.capabilities(); await self.ai.languageDetector.capabilities();
@ -31,6 +32,7 @@ if (supportsBrowserTranslator) {
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
})();
} }
// https://developer.chrome.com/docs/ai/translator-api // https://developer.chrome.com/docs/ai/translator-api