Total noob help required

You could also directly call those functions with the necessary variable:

async function layer_pictures(mode){...}

function layer_pictures_caller(mode) {
    try {
        require('photoshop').core.executeAsModal(() => layer_pictures(mode));
    }
...
}

document.getElementById("btn_dropin_normal").addEventListener("click", () => layer_pictures_caller("normal"));
document.getElementById("btn_dropin_screen").addEventListener("click", () => layer_pictures_caller("screen"));

If you want to unsubscribe from that eventListener at a later point you’d have to move those inline handlers to a variable like

const handleNormalDropin = () => layer_pictures_caller("normal")
document.getElementById("btn_dropin_normal").addEventListener("click", handleNormalDropin);
1 Like