Instead of checking within our events itself at the time of the event, we memorize the state of resolved and reached ready-states. Why? Some WordPress plugins are modifying the JavaScript execution waterfall (e.g. Delay JS in WP Rocket).
Wait DOM is ready depending on a state.
interactive
: Defer scripts are executing, but DOM is readycomplete
: All scripts including deferred ones are executed and DOM is readyGenerated using TypeDoc
Listen to multiple events. Why? See same reason as in
memorizedReadyStatePromises()
.