[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> dom-ready.js.map (source)

   1  {
   2    "version": 3,
   3    "sources": ["../../../packages/dom-ready/src/index.js"],
   4    "sourcesContent": ["/**\n * @typedef {() => void} Callback\n *\n * TODO: Remove this typedef and inline `() => void` type.\n *\n * This typedef is used so that a descriptive type is provided in our\n * automatically generated documentation.\n *\n * An in-line type `() => void` would be preferable, but the generated\n * documentation is `null` in that case.\n *\n * @see https://github.com/WordPress/gutenberg/issues/18045\n */\n\n/**\n * Specify a function to execute when the DOM is fully loaded.\n *\n * @param {Callback} callback A function to execute after the DOM is ready.\n *\n * @example\n * ```js\n * import domReady from '@wordpress/dom-ready';\n *\n * domReady( function() {\n * \t//do something after DOM loads.\n * } );\n * ```\n *\n * @return {void}\n */\nexport default function domReady( callback ) {\n\tif ( typeof document === 'undefined' ) {\n\t\treturn;\n\t}\n\n\tif (\n\t\tdocument.readyState === 'complete' || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly.\n\t\tdocument.readyState === 'interactive' // DOMContentLoaded fires at this point, so we call directly.\n\t) {\n\t\treturn void callback();\n\t}\n\n\t// DOMContentLoaded has not fired yet, delay callback until then.\n\tdocument.addEventListener( 'DOMContentLoaded', callback );\n}\n"],
   5    "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AA8Be,WAAR,SAA2B,UAAW;AAC5C,QAAK,OAAO,aAAa,aAAc;AACtC;IACD;AAEA,QACC,SAAS,eAAe;IACxB,SAAS,eAAe,eACvB;AACD,aAAO,KAAK,SAAS;IACtB;AAGA,aAAS,iBAAkB,oBAAoB,QAAS;EACzD;",
   6    "names": []
   7  }


Generated : Wed Apr 22 08:20:11 2026 Cross-referenced by PHPXref