Skip to content

Commit

Permalink
prevent multiple scripts execution
Browse files Browse the repository at this point in the history
  • Loading branch information
jemikanegara committed Oct 19, 2024
1 parent 101c195 commit 7b2b581
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ const { PREV_SCRIPT_VERSION } = require("./utils/configs.js");
// const { checkPage } = require("./utils/translation/checkPage.js");

if (isBrowser()) {
// prevent multiple scripts execution
if (window.firstGlobalseoScriptExecuted) return;
window.firstGlobalseoScriptExecuted = true;

window.translationScriptTag = window.document.currentScript;
window.translationScriptPrevVersion = PREV_SCRIPT_VERSION // called prev version because it will bumped after published to npm

Expand Down

0 comments on commit 7b2b581

Please sign in to comment.