diff options
author | Cashew <52880648+Scrub1492@users.noreply.github.com> | 2023-12-27 22:45:58 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 15:45:58 +0000 |
commit | 60cd218663f62f79394e9c0247e0fe40de6589b6 (patch) | |
tree | 80693aa1cd41cce0558b50680bfc70e51ed91be1 | |
parent | 623e056fe6322c1d0f07554aea2fabf2f834e8a5 (diff) |
Remove IIFEs (#452)
* remove IIFEs
* Move IIFE into function
* revert google-docs.js to IIFE
* add entry point jsdoc
* revert content-script-wrapper
-rw-r--r-- | ext/js/yomitan.js | 11 |
1 files changed, 8 insertions, 3 deletions
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; |