Skip to content

Commit

Permalink
Fix a small potential refactoring mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-PH committed Feb 3, 2024
1 parent c474577 commit f96bcf0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
20 changes: 3 additions & 17 deletions src/contentScript/contentScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { disconnectTabTitlePreserver, disconnectFaviconPreserver } from "./prese
import listenerManager from "./listenerManager";
import { EVENT_OPEN_RENAME_DIALOG, ROOT_ELEMENT_ID, ROOT_TAG_NAME } from "../config";
import { createRoot } from 'react-dom/client';
import bgScriptApi from "./backgroundScriptApi";
import App from './components/App';
import React from 'react';
import { updateTabSignatureFromStorage } from "./updateSignatureFromStorage";
// eslint-disable-next-line no-unused-vars
import log from "../log";
import { setTabTitle, setTabFavicon } from "./setters";

// Global variables:
let uiInsertedIntoDOM = false;
Expand All @@ -15,21 +15,7 @@ let root = null;
/** Update tab signature when the contentScript loads:
* This is an immediately invoked function expression (IIFE)
*/
(async function updateTabSignatureFromStorage() {
log.debug('updateTabSignatureFromStorage called');
const signature = await bgScriptApi.loadSignature();
if (signature) {
log.debug('retrieved signature:', signature);
if (signature.title) {
setTabTitle(signature.title, true);
}
if (signature.favicon) {
setTabFavicon(signature.favicon, true);
}
} else {
log.debug('no signature found');
}
})();
updateTabSignatureFromStorage();

function insertUIIntoDOM() {
if (uiInsertedIntoDOM === false) {
Expand Down
4 changes: 2 additions & 2 deletions src/contentScript/updateSignatureFromStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { setTabTitle, setTabFavicon } from "./setters";
/** Update tab signature when the contentScript loads:
* This is an immediately invoked function expression (IIFE)
*/
(async function updateTabSignatureFromStorage() {
export async function updateTabSignatureFromStorage() {
log.debug('updateTabSignatureFromStorage called');
const signature = await bgScriptApi.loadSignature();
if (signature) {
Expand All @@ -19,4 +19,4 @@ import { setTabTitle, setTabFavicon } from "./setters";
} else {
log.debug('no signature found');
}
})();
}

0 comments on commit f96bcf0

Please sign in to comment.