Remove compression cache feature
Some checks failed
Make Latest Folder On EmulatorJS CDN / run (push) Has been cancelled

This commit is contained in:
Ethan O'Brien 2024-08-06 07:35:08 -05:00
parent 588a5e2beb
commit 685f3ebfef

View file

@ -1,5 +1,4 @@
class EJS_COMPRESSION { class EJS_COMPRESSION {
cache = {};
constructor(EJS) { constructor(EJS) {
this.EJS = EJS; this.EJS = EJS;
} }
@ -37,16 +36,12 @@ class EJS_COMPRESSION {
path = "compression/libunrar.js"; path = "compression/libunrar.js";
obj = "rar"; obj = "rar";
} }
if (this.cache[obj]) {
return this.cache[obj];
}
this.EJS.downloadFile(path, (res) => { this.EJS.downloadFile(path, (res) => {
if (res === -1) { if (res === -1) {
this.EJS.startGameError(this.EJS.localization('Network Error')); this.EJS.startGameError(this.EJS.localization('Network Error'));
return; return;
} }
if (method === "rar") { if (method === "rar") {
// Do not cache rar. This shouldnt normally be used more than once anyways.
this.EJS.downloadFile("compression/libunrar.wasm", (res2) => { this.EJS.downloadFile("compression/libunrar.wasm", (res2) => {
if (res2 === -1) { if (res2 === -1) {
this.EJS.startGameError(this.EJS.localization('Network Error')); this.EJS.startGameError(this.EJS.localization('Network Error'));
@ -63,7 +58,6 @@ class EJS_COMPRESSION {
const blob = new Blob([res.data], { const blob = new Blob([res.data], {
type: 'application/javascript' type: 'application/javascript'
}) })
this.cache[obj] = blob;
resolve(blob); resolve(blob);
} }
}, null, false, {responseType: "arraybuffer", method: "GET"}); }, null, false, {responseType: "arraybuffer", method: "GET"});