Can you help me make it work, because it doesn’t work for me in my plugin?
this code:
const suspendHistory = async (theSuspendName, functionName) => {await exeModal(doStuff, {"commandName": "Please Wait"});
async function doStuff(executionContext){
let hostControl = executionContext.hostControl;
let documentID = await app.activeDocument._id;
// Suspend history state on the target document
let suspensionID = await hostControl.suspendHistory({
"historyStateInfo": {
"name": theSuspendName,
"target": [ {_ref: "document", _id: documentID}]
}
});
// console.log(functionName);
await exeModal( functionName, );
await hostControl.resumeHistory(suspensionID);
};
};
const doIt = async () => {
await suspendHistory("2D Gradient", doIt_1);
};
document.getElementById("btn_DoIt").addEventListener("click", async function () {await doIt()});
Regards…
Mohamed Fathy…