diff --git a/packages/dom-ready/README.md b/packages/dom-ready/README.md index ae477294deafc..0c8515e57f3b1 100644 --- a/packages/dom-ready/README.md +++ b/packages/dom-ready/README.md @@ -12,30 +12,26 @@ npm install @wordpress/dom-ready --save _This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods. Learn more about it in [Babel docs](https://babeljs.io/docs/en/next/caveats)._ -### Usage - -```JS -import domReady from '@wordpress/dom-ready'; - -domReady( function() { - //do something after DOM loads. -} ); -``` - -## Browser support - -See - ## API ### default -[src/index.js#L20-L20](src/index.js#L20-L20) +[src/index.js#L29-L29](src/index.js#L29-L29) Specify a function to execute when the DOM is fully loaded. +**Usage** + +```js +import domReady from '@wordpress/dom-ready'; + +domReady( function() { + //do something after DOM loads. +} ); +``` + **Parameters** - **callback** `Function`: A function to execute after the DOM is ready. @@ -47,4 +43,8 @@ Specify a function to execute when the DOM is fully loaded. +## Browser support + +See +

Code is Poetry.

diff --git a/packages/dom-ready/src/index.js b/packages/dom-ready/src/index.js index f19b862e0e28c..82c0ed781d5e1 100644 --- a/packages/dom-ready/src/index.js +++ b/packages/dom-ready/src/index.js @@ -3,6 +3,15 @@ * * @param {Function} callback A function to execute after the DOM is ready. * + * @example + * ```js + * import domReady from '@wordpress/dom-ready'; + * + * domReady( function() { + * //do something after DOM loads. + * } ); + * ``` + * * @return {void} */ const domReady = function( callback ) {