iOS 12 support
Some checks are pending
Make Latest Folder On EmulatorJS CDN / run (push) Waiting to run

This commit is contained in:
Ethan O'Brien 2024-08-18 21:31:34 -05:00
parent 83768b6804
commit d9e1e69d9c
2 changed files with 220 additions and 220 deletions

View file

@ -89,7 +89,6 @@ class EmulatorJS {
} }
return options[core] || core; return options[core] || core;
} }
extensions = []
createElement(type) { createElement(type) {
return document.createElement(type); return document.createElement(type);
} }
@ -225,6 +224,8 @@ class EmulatorJS {
} }
constructor(element, config) { constructor(element, config) {
this.ejs_version = "4.0.13-beta"; this.ejs_version = "4.0.13-beta";
this.extensions = [];
this.initControlVars();
this.debug = (window.EJS_DEBUG_XX === true); this.debug = (window.EJS_DEBUG_XX === true);
if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates(); if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates();
this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true); this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true);
@ -397,12 +398,13 @@ class EmulatorJS {
this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]); this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]);
} }
} }
functions = {};
on(event, func) { on(event, func) {
if (!this.functions) this.functions = {};
if (!Array.isArray(this.functions[event])) this.functions[event] = []; if (!Array.isArray(this.functions[event])) this.functions[event] = [];
this.functions[event].push(func); this.functions[event].push(func);
} }
callEvent(event, data) { callEvent(event, data) {
if (!this.functions) this.functions = {};
if (!Array.isArray(this.functions[event])) return 0; if (!Array.isArray(this.functions[event])) return 0;
this.functions[event].forEach(e => e(data)); this.functions[event].forEach(e => e(data));
return this.functions[event].length; return this.functions[event].length;
@ -2773,7 +2775,8 @@ class EmulatorJS {
this.controlMenu.appendChild(popup); this.controlMenu.appendChild(popup);
} }
defaultControllers = { initControlVars() {
this.defaultControllers = {
0: { 0: {
0: { 0: {
'value': 'x', 'value': 'x',
@ -2888,7 +2891,7 @@ class EmulatorJS {
2: {}, 2: {},
3: {} 3: {}
} }
keyMap = { this.keyMap = {
0: '', 0: '',
8: 'backspace', 8: 'backspace',
9: 'tab', 9: 'tab',
@ -2990,7 +2993,7 @@ class EmulatorJS {
221: 'close braket', 221: 'close braket',
222: 'single quote' 222: 'single quote'
} }
controls; }
setupKeys() { setupKeys() {
for (let i=0; i<4; i++) { for (let i=0; i<4; i++) {
for (let j=0; j<30; j++) { for (let j=0; j<30; j++) {

View file

@ -1,7 +1,4 @@
class GamepadHandler { class GamepadHandler {
gamepads;
timeout;
listeners;
constructor() { constructor() {
this.buttonLabels = { this.buttonLabels = {
0: 'BUTTON_1', 0: 'BUTTON_1',