I need to have access to the dom of the legend after it is rendered every time a user makes a query, and I am using ESM modules with the new, 4.19 API. I am trying to stay away from dojo. So how can I replace dojo/aspect and dojo/query with something that works with the new API? My project is a node project with webpack, with no specific framework. Here it is what worked before using the 4.17 API and AMD modules Thank you for any help!
watchUtils.when(legend, "container", function () {
aspect.after(legend, "scheduleRender", function (response: any) {
if (query('.esri-legend__layer-cell--info')[0]) {
var legendinfotitle2 = document.querySelectorAll("h3.esri-widget__heading.esri-legend__service-label");
var legendinfo = document.querySelectorAll(".esri-legend__layer-cell--info")[0];
if (legendinfo) {
legendinfotitle2[0].innerHTML = " ";
}
setTimeout(function () {
// changeUrlLabel()
if (view.popup.selectedFeature != undefined) {
var selectedProgramTitle = view.popup.selectedFeature.attributes.ProgramName;
}
if (legendinfo) {
if (legend.activeLayerInfos) {
if (selectedProgramTitle != "Northeast Texas Habitat Incentive Program" && selectedProgramTitle != "Texas Longleaf Conservation Assistance Program"
&& selectedProgramTitle != "Longleaf Pine Initiative") {
legendinfotitle2[0].innerHTML = " ";
}
else {
legendinfotitle2[0].innerHTML = selectedProgramTitle;
}
}
}
document.getElementById("legendDiv").style.display = "block";
}, 400);
}
});
});