How do I run code on DOM ready in Greasemonkey 4?

Viewed 4823

With the update to Firefox 57 and Greasemonkey 4 a number of my userscripts broke. In some scripts I used:

document.addEventListener('DOMContentLoaded', doStuff, false);

This no longer works in Greasemonkey. What is the proper way to add an DOMContentLoaded event now?

P.S. I checked that at the time of registering the event, DOM is still not ready.

2 Answers
Related