Fix global declaration of staticRoot and webRoot

These variables were intended to be globals declare in the global
namespace. That this ends up on the window object is an implementation
detail of JavaScript. Remove the window. prefix put in front of
staticRoot and webRoot and include the global declaration in the
TypeScript module.
This commit is contained in:
Hornwitser committed 2023-11-28 15:35:40 +01:00
1 parent 9df6717364
commit ceb7e48c99
14 files changed
+27 -23

No files matched your search

+2 -2
View File
@@ -22,7 +22,7 @@ export function useItemMetadata() {
) {
return;
}
let response = await fetch(`${window.staticRoot}static/${exportManifest.assets["item-metadata"]}`);
let response = await fetch(`${staticRoot}static/${exportManifest.assets["item-metadata"]}`);
if (response.ok) {
let data = await response.json();
itemMetadataCache = new Map(data);
@@ -31,7 +31,7 @@ export function useItemMetadata() {
for (let [name, meta] of itemMetadataCache) {
style.sheet!.insertRule(`\
.item-${CSS.escape(name)} {
background-image: url("${window.staticRoot}static/${exportManifest.assets["item-spritesheet"]}");
background-image: url("${staticRoot}static/${exportManifest.assets["item-spritesheet"]}");
background-repeat: no-repeat;
background-position: -${meta.x}px -${meta.y}px;
height: ${meta.size}px;
+1 -1
View File
@@ -12,7 +12,7 @@ export function useLocale(): Map<string, string> {
if (!exportManifest?.assets?.["locale"]) {
return;
}
let response = await fetch(`${window.staticRoot}static/${exportManifest.assets["locale"]}`);
let response = await fetch(`${staticRoot}static/${exportManifest.assets["locale"]}`);
if (response.ok) {
let data = await response.json();
localeCache = new Map(data);