I'm trying to run an auto script that submits data. I have few validations check to get the buttons to popup in the UI, for that I'm firing the input events. Is there any way, we can check the EVENT is fired / completed? Here are few of the methods:
//For Dispacthing Events
function dipacthEvents() {
return new Promise(async (res, rej) => {
const event = new Event('input', {
bubbles: false
});
const ip = new Event('input', {
bubbles: false
});
await window.tinyMCE.triggerSave()
await document.querySelectorAll('[ng-name = "CoreProperties-Key0"]')[0].dispatchEvent(event);
await document.querySelectorAll('[ng-name = "CoreProperties-Name0"]')[0].dispatchEvent(ip);
res("dipactched");
})
}
//main
function createKey(key, value) {
updateFields(key, value);
dipacthEvents()
.then(async (msg) => {
console.log(msg)
await updateClicks();
})
}
updateClicks()
have DOM elements manipulations for click buttons. How can I make sure click method runs after all the event are fired?
Appreciate any help here!