MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / getBaseFileName

Method getBaseFileName

data/src/emulator.js:647–662  ·  view source on GitHub ↗
(force)

Source from the content-addressed store, hash-verified

645 document.body.appendChild(script);
646 }
647 getBaseFileName(force) {
648 //Only once game and core is loaded
649 if (!this.started && !force) return null;
650 if (force && this.config.gameUrl !== "game" && !this.config.gameUrl.startsWith("blob:")) {
651 return this.config.gameUrl.split("/").pop().split("#")[0].split("?")[0];
652 }
653 if (typeof this.config.gameName === "string") {
654 const invalidCharacters = /[#<$+%>!`&*'|{}/\\?"=@:^\r\n]/ig;
655 const name = this.config.gameName.replace(invalidCharacters, "").trim();
656 if (name) return name;
657 }
658 if (!this.fileName) return "game";
659 let parts = this.fileName.split(".");
660 parts.splice(parts.length - 1, 1);
661 return parts.join(".");
662 }
663 saveInBrowserSupported() {
664 return !!window.indexedDB && (typeof this.config.gameName === "string" || !this.config.gameUrl.startsWith("blob:"));
665 }

Callers 4

gotGameDataMethod · 0.95
createContextMenuMethod · 0.95
createBottomMenuBarMethod · 0.95
screenRecordMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected