| 1 |
/******/ (function() { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ // The require scope |
| 4 |
/******/ var __webpack_require__ = {}; |
| 5 |
/******/ |
| 6 |
/************************************************************************/ |
| 7 |
/******/ /* webpack/runtime/define property getters */ |
| 8 |
/******/ !function() { |
| 9 |
/******/ // define getter functions for harmony exports |
| 10 |
/******/ __webpack_require__.d = function(exports, definition) { |
| 11 |
/******/ for(var key in definition) { |
| 12 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 13 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 14 |
/******/ } |
| 15 |
/******/ } |
| 16 |
/******/ }; |
| 17 |
/******/ }(); |
| 18 |
/******/ |
| 19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 20 |
/******/ !function() { |
| 21 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
| 22 |
/******/ }(); |
| 23 |
/******/ |
| 24 |
/************************************************************************/ |
| 25 |
var __webpack_exports__ = {}; |
| 26 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 27 |
/* harmony export */ "default": function() { return /* binding */ domReady; } |
| 28 |
/* harmony export */ }); |
| 29 |
/** |
| 30 |
* @typedef {() => void} Callback |
| 31 |
* |
| 32 |
* TODO: Remove this typedef and inline `() => void` type. |
| 33 |
* |
| 34 |
* This typedef is used so that a descriptive type is provided in our |
| 35 |
* automatically generated documentation. |
| 36 |
* |
| 37 |
* An in-line type `() => void` would be preferable, but the generated |
| 38 |
* documentation is `null` in that case. |
| 39 |
* |
| 40 |
* @see https://github.com/WordPress/gutenberg/issues/18045 |
| 41 |
*/ |
| 42 |
|
| 43 |
/** |
| 44 |
* Specify a function to execute when the DOM is fully loaded. |
| 45 |
* |
| 46 |
* @param {Callback} callback A function to execute after the DOM is ready. |
| 47 |
* |
| 48 |
* @example |
| 49 |
* ```js |
| 50 |
* import domReady from '@wordpress/dom-ready'; |
| 51 |
* |
| 52 |
* domReady( function() { |
| 53 |
* //do something after DOM loads. |
| 54 |
* } ); |
| 55 |
* ``` |
| 56 |
* |
| 57 |
* @return {void} |
| 58 |
*/ |
| 59 |
function domReady(callback) { |
| 60 |
if (typeof document === 'undefined') { |
| 61 |
return; |
| 62 |
} |
| 63 |
|
| 64 |
if (document.readyState === 'complete' || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly. |
| 65 |
document.readyState === 'interactive' // DOMContentLoaded fires at this point, so we call directly. |
| 66 |
) { |
| 67 |
return void callback(); |
| 68 |
} // DOMContentLoaded has not fired yet, delay callback until then. |
| 69 |
|
| 70 |
|
| 71 |
document.addEventListener('DOMContentLoaded', callback); |
| 72 |
} |
| 73 |
//# sourceMappingURL=index.js.map |
| 74 |
(window.wp = window.wp || {}).domReady = __webpack_exports__.default; |
| 75 |
/******/ })() |
| 76 |
; |