Skip to content

Commit

Permalink
Remove IIFEs (#452)
Browse files Browse the repository at this point in the history
* remove IIFEs

* Move IIFE into function

* revert google-docs.js to IIFE

* add entry point jsdoc

* revert content-script-wrapper
  • Loading branch information
Casheeew authored Dec 27, 2023
1 parent 623e056 commit 60cd218
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ext/js/yomitan.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 60cd218

Please sign in to comment.