Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/callmecavs/one-ready
A Promise wrapper for DOMContentLoaded that prevents event duplication.
https://github.com/callmecavs/one-ready
dom promise ready then
Last synced: 15 days ago
JSON representation
A Promise wrapper for DOMContentLoaded that prevents event duplication.
- Host: GitHub
- URL: https://github.com/callmecavs/one-ready
- Owner: callmecavs
- Created: 2017-03-06T03:13:36.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T22:22:51.000Z (almost 8 years ago)
- Last Synced: 2024-12-10T13:46:33.457Z (about 1 month ago)
- Topics: dom, promise, ready, then
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# one-ready
[![one-ready on NPM](https://img.shields.io/npm/v/one-ready.svg?style=flat-square)](https://www.npmjs.com/package/one-ready) [![Standard JavaScript Style](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
A Promise wrapper for DOMContentLoaded that prevents event duplication.
## Install
```sh
$ npm i one-ready --save
```## Use
Respond to the DOM being ready in different JS modules without binding multiple `DOMContentLoaded` handlers.
```javascript
import ready from 'one-ready'ready.then(() => console.log('Only one DOMContentLoaded event handler is bound.'))
ready.then(() => console.log('Even if imported and called in other modules.'))
```## See Also
* [hsx](https://github.com/callmecavs/hsx) - JSX, webpack, and static Components without React.
## License
[MIT](https://opensource.org/licenses/MIT). © 2017 Michael Cavalea