mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
f76d05bffa
The TopMenuModule binds the buttons so that they open the sub menus: at the moment it also binds those events that don't have a proper place yet. FileManager contains all the functions that have something to do with files, that is loading, opening, saving and exporting.
21 lines
692 B
JavaScript
21 lines
692 B
JavaScript
class Input {
|
|
static on(event, elementId, functionCallback, ...args) {
|
|
//if element provided is string, get the actual element
|
|
const element = Util.getElement(elementId);
|
|
|
|
element.addEventListener(event,
|
|
function (e) {
|
|
functionCallback(...args, e);
|
|
});
|
|
}
|
|
|
|
static onChildren(event, parentElement, functionCallback, ...args) {
|
|
parentElement = Util.getElement(parentElement);
|
|
const children = parentElement.children;
|
|
|
|
//loop through children and add onClick listener
|
|
for (var i = 0; i < children.length; i++) {
|
|
on(event, children[i], functionCallback, ...args);
|
|
}
|
|
}
|
|
} |