()
| 4142 | localStorage.setItem(this.getLocalStorageKey(), JSON.stringify(coreSpecific)); |
| 4143 | } |
| 4144 | getLocalStorageKey() { |
| 4145 | let identifier = (this.config.gameId || 1) + "-" + this.getCore(true); |
| 4146 | if (typeof this.config.gameName === "string") { |
| 4147 | identifier += "-" + this.config.gameName; |
| 4148 | } else if (typeof this.config.gameUrl === "string" && !this.config.gameUrl.toLowerCase().startsWith("blob:")) { |
| 4149 | identifier += "-" + this.config.gameUrl; |
| 4150 | } else if (this.config.gameUrl instanceof File) { |
| 4151 | identifier += "-" + this.config.gameUrl.name; |
| 4152 | } else if (typeof this.config.gameId !== "number") { |
| 4153 | console.warn("gameId (EJS_gameID) is not set. This may result in settings persisting across games."); |
| 4154 | } |
| 4155 | return "ejs-" + identifier + "-settings"; |
| 4156 | } |
| 4157 | preGetSetting(setting) { |
| 4158 | if (window.localStorage && !this.config.disableLocalStorage) { |
| 4159 | let coreSpecific = localStorage.getItem(this.getLocalStorageKey()); |
no test coverage detected