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: 3 months 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T22:22:51.000Z (over 8 years ago)
- Last Synced: 2025-06-27T12:18:30.245Z (4 months ago)
- Topics: dom, promise, ready, then
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# one-ready
[](https://www.npmjs.com/package/one-ready) [](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