mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Cache limit
This commit is contained in:
parent
b53577aa30
commit
9a790b70db
2 changed files with 8 additions and 4 deletions
|
@ -612,10 +612,13 @@ class EmulatorJS {
|
|||
return;
|
||||
}
|
||||
gotGameData(res.data);
|
||||
this.storage.rom.put(this.config.gameUrl.split("/").pop(), {
|
||||
"content-length": res.headers['content-length'],
|
||||
data: res.data
|
||||
})
|
||||
const limit = (typeof this.config.cacheLimit === "number") ? this.config.cacheLimit : 1073741824;
|
||||
if (parseFloat(res.headers['content-length']) < limit) {
|
||||
this.storage.rom.put(this.config.gameUrl.split("/").pop(), {
|
||||
"content-length": res.headers['content-length'],
|
||||
data: res.data
|
||||
})
|
||||
}
|
||||
}, (progress) => {
|
||||
this.textElem.innerText = this.localization("Download Game Data") + progress;
|
||||
}, true, {responseType: "arraybuffer", method: "GET"});
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
config.startOnLoad = window.EJS_startOnLoaded;
|
||||
config.filePaths = window.EJS_paths;
|
||||
config.loadState = window.EJS_loadStateURL;
|
||||
config.cacheLimit = window.EJS_CacheLimit;
|
||||
|
||||
new EmulatorJS(EJS_player, config);
|
||||
|
||||
|
|
Loading…
Reference in a new issue