2022-04-11 08:04:30 -04:00
|
|
|
/******/ (function() { // webpackBootstrap
|
|
|
|
/******/ "use strict";
|
|
|
|
/******/ // The require scope
|
|
|
|
/******/ var __webpack_require__ = {};
|
|
|
|
/******/
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ /* webpack/runtime/define property getters */
|
|
|
|
/******/ !function() {
|
|
|
|
/******/ // define getter functions for harmony exports
|
|
|
|
/******/ __webpack_require__.d = function(exports, definition) {
|
|
|
|
/******/ for(var key in definition) {
|
|
|
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
|
|
/******/ }
|
|
|
|
/******/ }
|
2018-12-13 23:41:57 -05:00
|
|
|
/******/ };
|
2022-04-11 08:04:30 -04:00
|
|
|
/******/ }();
|
|
|
|
/******/
|
|
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
|
|
/******/ !function() {
|
|
|
|
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
|
|
|
/******/ }();
|
|
|
|
/******/
|
2018-12-13 23:41:57 -05:00
|
|
|
/************************************************************************/
|
2022-04-11 08:04:30 -04:00
|
|
|
var __webpack_exports__ = {};
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
|
/* harmony export */ "default": function() { return /* binding */ domReady; }
|
|
|
|
/* harmony export */ });
|
2020-01-22 17:06:21 -05:00
|
|
|
/**
|
|
|
|
* @typedef {() => void} Callback
|
|
|
|
*
|
|
|
|
* TODO: Remove this typedef and inline `() => void` type.
|
|
|
|
*
|
|
|
|
* This typedef is used so that a descriptive type is provided in our
|
|
|
|
* automatically generated documentation.
|
|
|
|
*
|
|
|
|
* An in-line type `() => void` would be preferable, but the generated
|
|
|
|
* documentation is `null` in that case.
|
|
|
|
*
|
|
|
|
* @see https://github.com/WordPress/gutenberg/issues/18045
|
|
|
|
*/
|
|
|
|
|
2018-12-13 23:41:57 -05:00
|
|
|
/**
|
|
|
|
* Specify a function to execute when the DOM is fully loaded.
|
|
|
|
*
|
2020-01-22 17:06:21 -05:00
|
|
|
* @param {Callback} callback A function to execute after the DOM is ready.
|
2018-12-13 23:41:57 -05:00
|
|
|
*
|
2019-03-21 08:48:00 -04:00
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* import domReady from '@wordpress/dom-ready';
|
|
|
|
*
|
|
|
|
* domReady( function() {
|
|
|
|
* //do something after DOM loads.
|
|
|
|
* } );
|
|
|
|
* ```
|
|
|
|
*
|
2018-12-13 23:41:57 -05:00
|
|
|
* @return {void}
|
|
|
|
*/
|
2020-01-22 17:06:21 -05:00
|
|
|
function domReady(callback) {
|
2021-04-15 11:19:43 -04:00
|
|
|
if (typeof document === 'undefined') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-12-13 23:41:57 -05:00
|
|
|
if (document.readyState === 'complete' || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly.
|
|
|
|
document.readyState === 'interactive' // DOMContentLoaded fires at this point, so we call directly.
|
|
|
|
) {
|
2021-11-15 07:50:17 -05:00
|
|
|
return void callback();
|
|
|
|
} // DOMContentLoaded has not fired yet, delay callback until then.
|
2018-12-13 23:41:57 -05:00
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', callback);
|
2020-01-22 17:06:21 -05:00
|
|
|
}
|
2018-12-13 23:41:57 -05:00
|
|
|
|
2022-04-11 08:04:30 -04:00
|
|
|
(window.wp = window.wp || {}).domReady = __webpack_exports__["default"];
|
|
|
|
/******/ })()
|
|
|
|
;
|