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

Method checkStarted

data/src/emulator.js:1038–1064  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1036 this.callEvent("start");
1037 }
1038 checkStarted() {
1039 (async () => {
1040 let sleep = (ms) => new Promise(r => setTimeout(r, ms));
1041 let state = "suspended";
1042 let popup;
1043 while (state === "suspended") {
1044 if (!this.Module.AL) return;
1045 this.Module.AL.currentCtx.sources.forEach(ctx => {
1046 state = ctx.gain.context.state;
1047 });
1048 if (state !== "suspended") break;
1049 if (!popup) {
1050 popup = this.createPopup("", {});
1051 const button = this.createElement("button");
1052 button.innerText = this.localization("Click to resume Emulator");
1053 button.classList.add("ejs_menu_button");
1054 button.style.width = "25%";
1055 button.style.height = "25%";
1056 popup.appendChild(button);
1057 popup.style["text-align"] = "center";
1058 popup.style["font-size"] = "28px";
1059 }
1060 await sleep(10);
1061 }
1062 if (popup) this.closePopup();
1063 })();
1064 }
1065 bindListeners() {
1066 this.createContextMenu();
1067 this.createBottomMenuBar();

Callers 1

startGameMethod · 0.95

Calls 4

createPopupMethod · 0.95
createElementMethod · 0.95
localizationMethod · 0.95
closePopupMethod · 0.95

Tested by

no test coverage detected