Skip to content

Commit

Permalink
dom-ready: set up autogenerated API docs (#14272)
Browse files Browse the repository at this point in the history
  • Loading branch information
nosolosw authored and youknowriad committed Mar 20, 2019
1 parent b9a9043 commit 319e7f3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/update-readmes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const packages = [
//'date',
//'deprecated',
'dom',
//'dom-ready',
'dom-ready',
'e2e-test-utils',
//'edit-post',
'element',
Expand Down
27 changes: 24 additions & 3 deletions packages/dom-ready/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,39 @@ 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
## API

```JS
<!-- START TOKEN(Autogenerated API docs) -->

### default

[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.

**Returns**

`void`:


<!-- END TOKEN(Autogenerated API docs) -->

## Browser support

See https://make.wordpress.org/design/handbook/design-guide/browser-support/
See <https://make.wordpress.org/design/handbook/design-guide/browser-support/>

<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
9 changes: 9 additions & 0 deletions packages/dom-ready/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 319e7f3

Please sign in to comment.