My div looks something like this:
It's possible with MutationObserver, but it's a somewhat odd thing to do:
console.log('Script start');
const div = document.querySelector('div');
const o = new MutationObserver(() => {
console.log('style changed');
});
o.observe(div, { attributes: true, attributeFilter: ["style"] });
setTimeout(() => {
div.style.backgroundImage = 'url(https://www.gravatar.com/avatar/34932d3e923ffad9a4a1423e30b1d9fc?s=48&d=identicon&r=PG&f=1)';
}, 500);
xx
It would make a lot more sense for the function that makes the style change to call other functions that need to know that the change happened.