I'm trying to access df-chips
.
However, that doesn't load at first sight, so I was trying to access it with asyng / await
. But... I'm not good at javascript, so I'm doing something wrong and I don't know what.
This is my code:
// Function to catch asynchronous that node
const asyncQuerySelector = async (node, query) => {
try {
if (node.querySelector(query)){
return await node.querySelector(query);
}
} catch (error) {
console.error(`Cannot find ${query ? `${query} in`: ''} ${node}.`, error);
return null;
}
};
const root = document.querySelector('#messageList')
const foo = asyncQuerySelector(root, 'df-chips')
But I'm getting a null
promise result: