Skip to content

Commit

Permalink
Merge example in JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Mar 7, 2019
1 parent 2ea8c25 commit 73917da
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
30 changes: 15 additions & 15 deletions packages/dom-ready/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://make.wordpress.org/design/handbook/design-guide/browser-support/>

## API

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

### 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.
Expand All @@ -47,4 +43,8 @@ Specify a function to execute when the DOM is fully loaded.

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

## 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 73917da

Please sign in to comment.