DomNodeInserted and DomNodeRemoved now deprecated

Ashamedly, I'm a jQuery user with very weak Javascript skills.

However, I noticed that Google Chrome DevTools console is giving me the following warning:

Listener added for a synchronous 'DOMNodeRemoved' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.

... as well as a similar warning for DomNodeInserted.

I'm horrible with Javascript. Can someone give me Javascript code I can copy/paste to replace what I currently have? This is my code:

$('#element').on('DOMNodeInserted DOMNodeRemoved', function(event) {
    function_call();
});