Skip to content

Commit

Permalink
feat: prevent multiple instances of the script from running
Browse files Browse the repository at this point in the history
  • Loading branch information
pilar6195 committed Jul 1, 2024
1 parent d96fa3b commit d91f4d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/anilist-extras.user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import '@/modules/modulesList';
/* Import Global Styles */
import globalStyles from '@/styles/global.scss';

// @ts-expect-error - This is fine.
if (document.ALEXTRAS_LOADED) {
throw new Error('AniList Extras is already loaded. Ensure you are not running multiple instances of the script.');
}

// @ts-expect-error - This is fine.
document.ALEXTRAS_LOADED = true;

/* Add Global Styles to DOM */
addStyles(globalStyles);

Expand Down

0 comments on commit d91f4d1

Please sign in to comment.