mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Fix for broken custom buttons (#1042)
* Fix for broken custom buttons * Removed non-standard formatting * Removed non-standard formatting * Removed non-standard formatting
This commit is contained in:
parent
8a7088a156
commit
e77610e890
@ -1346,9 +1346,22 @@ class EmulatorJS {
|
||||
continue;
|
||||
|
||||
// Check if the button exists in the default buttons, and update its properties
|
||||
// If the button does not exist, create a custom button
|
||||
if (!mergedButtonOptions[searchKey]) {
|
||||
console.warn(`Button "${searchKey}" is not a valid button.`);
|
||||
continue;
|
||||
// If the button does not exist in the default buttons, create a custom button
|
||||
// Custom buttons must have a displayName, icon, and callback property
|
||||
if (!buttonUserOpts[searchKey] || !buttonUserOpts[searchKey].displayName || !buttonUserOpts[searchKey].icon || !buttonUserOpts[searchKey].callback) {
|
||||
console.warn(`Custom button "${searchKey}" is missing required properties`);
|
||||
continue;
|
||||
}
|
||||
|
||||
mergedButtonOptions[searchKey] = {
|
||||
visible: true,
|
||||
displayName: buttonUserOpts[searchKey].displayName || searchKey,
|
||||
icon: buttonUserOpts[searchKey].icon || "",
|
||||
callback: buttonUserOpts[searchKey].callback || (() => { }),
|
||||
custom: true
|
||||
};
|
||||
}
|
||||
|
||||
// if the value is a boolean, set the visible property to the value
|
||||
|
||||
Loading…
Reference in New Issue
Block a user