mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Add ability to disable indexeddb
This commit is contained in:
parent
8ddd13c5f3
commit
905e3010e6
4 changed files with 37 additions and 5 deletions
|
@ -304,12 +304,21 @@ class EmulatorJS {
|
|||
return check;
|
||||
})();
|
||||
this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||||
if (config.disableDatabases) {
|
||||
this.storage = {
|
||||
rom: new window.EJS_DUMMYSTORAGE(),
|
||||
bios: new window.EJS_DUMMYSTORAGE(),
|
||||
core: new window.EJS_DUMMYSTORAGE(),
|
||||
states: new window.EJS_DUMMYSTORAGE()
|
||||
}
|
||||
} else {
|
||||
this.storage = {
|
||||
rom: new window.EJS_STORAGE("EmulatorJS-roms", "rom"),
|
||||
bios: new window.EJS_STORAGE("EmulatorJS-bios", "bios"),
|
||||
core: new window.EJS_STORAGE("EmulatorJS-core", "core"),
|
||||
states: new window.EJS_STORAGE("EmulatorJS-states", "states")
|
||||
}
|
||||
}
|
||||
|
||||
this.game.classList.add("ejs_game");
|
||||
if (typeof this.config.backgroundImg === "string") {
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
config.softLoad = window.EJS_softLoad;
|
||||
config.screenRecording = window.EJS_screenRecording;
|
||||
config.externalFiles = window.EJS_externalFiles;
|
||||
config.disableDatabases = window.EJS_disableDatabases;
|
||||
|
||||
if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") {
|
||||
try {
|
||||
|
|
|
@ -101,4 +101,25 @@ class EJS_STORAGE {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
class EJS_DUMMYSTORAGE {
|
||||
constructor() {}
|
||||
addFileToDB() {
|
||||
return new Promise(resolve => resolve());
|
||||
}
|
||||
get() {
|
||||
return new Promise(resolve => resolve());
|
||||
}
|
||||
put() {
|
||||
return new Promise(resolve => resolve());
|
||||
}
|
||||
remove() {
|
||||
return new Promise(resolve => resolve());
|
||||
}
|
||||
getSizes() {
|
||||
return new Promise(resolve => resolve({}));
|
||||
}
|
||||
}
|
||||
|
||||
window.EJS_STORAGE = EJS_STORAGE;
|
||||
window.EJS_DUMMYSTORAGE = EJS_DUMMYSTORAGE;
|
||||
|
|
|
@ -231,6 +231,7 @@
|
|||
window.EJS_pathtodata = "data/";
|
||||
window.EJS_startOnLoaded = true;
|
||||
window.EJS_DEBUG_XX = enableDebug;
|
||||
window.EJS_disableDatabases = true;
|
||||
|
||||
script.src = "data/loader.js";
|
||||
document.body.appendChild(script);
|
||||
|
|
Loading…
Reference in a new issue