From 60cd218663f62f79394e9c0247e0fe40de6589b6 Mon Sep 17 00:00:00 2001 From: Cashew <52880648+Scrub1492@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:45:58 +0700 Subject: Remove IIFEs (#452) * remove IIFEs * Move IIFE into function * revert google-docs.js to IIFE * add entry point jsdoc * revert content-script-wrapper --- ext/js/yomitan.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ext/js') diff --git a/ext/js/yomitan.js b/ext/js/yomitan.js index 2fbe99cc..7505c0ca 100644 --- a/ext/js/yomitan.js +++ b/ext/js/yomitan.js @@ -21,8 +21,10 @@ import {CrossFrameAPI} from './comm/cross-frame-api.js'; import {EventDispatcher, deferPromise, invokeMessageHandler, log} from './core.js'; import {ExtensionError} from './core/extension-error.js'; -// Set up chrome alias if it's not available (Edge Legacy) -if ((() => { +/** + * @returns {boolean} + */ +function checkChromeNotAvailable() { let hasChrome = false; let hasBrowser = false; try { @@ -36,7 +38,10 @@ if ((() => { // NOP } return (hasBrowser && !hasChrome); -})()) { +} + +// Set up chrome alias if it's not available (Edge Legacy) +if (checkChromeNotAvailable()) { // @ts-expect-error - objects should have roughly the same interface // eslint-disable-next-line no-global-assign chrome = browser; -- cgit v1.2.3