function whenDOMReady() {
		return new Promise(function(resolve) {
			function onLoaded() {
				document.removeEventListener( "DOMContentLoaded", onLoaded, false );
				resolve();
			}

			if ( document.readyState === 'loading' ) {
				document.addEventListener( "DOMContentLoaded", onLoaded, false );
			} else {
				resolve();
			}
		});
	}
/**
	 * Execute the given callback once the DOM is ready (which might already be the case).
	 *
	 * @returns {Promise<void>} Returns a promise that settles after DOM became ready
	 */
Execute the given callback once the DOM is ready (which might already be the case).
@returns {Promise} Returns a promise that settles after DOM became ready
Execute the given callback once the DOM is ready ( which might already be the case ) . @returns { Promise } Returns a promise that settles after DOM became ready
function whenDOMReady() {
		return new Promise(function(resolve) {
			function onLoaded() {
				document.removeEventListener( "DOMContentLoaded", onLoaded, false );
				resolve();
			}
			if ( document.readyState === 'loading' ) {
				document.addEventListener( "DOMContentLoaded", onLoaded, false );
			} else {
				resolve();
			}
		});
	}
function whenDOMReady ( ) { return new Promise ( function ( resolve ) { function onLoaded ( ) { document . removeEventListener ( "DOMContentLoaded" , onLoaded , false ) ; resolve ( ) ; } if ( document . readyState === 'loading' ) { document . addEventListener ( "DOMContentLoaded" , onLoaded , false ) ; } else { resolve ( ) ; } } ) ; }
Execute the given callback once the DOM is ready (which might already be the case).
Execute the given callback once the DOM is ready ( which might already be the case ) .