# load-promises

> DOM load events as promises

Latest version **2.0.2** (published 2019-02-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install load-promises
pnpm add load-promises
yarn add load-promises
bun add load-promises
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2019-02-19 |
| First published | 2017-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alejandro Fernández Gómez |
| Maintainers | afgomez |
| Keywords | DOMContentLoaded |

## Links

- npm: https://www.npmjs.com/package/load-promises
- Repository: https://github.com/afgomez/load-promises
- Homepage: https://github.com/afgomez/load-promises#readme
- Issues: https://github.com/afgomez/load-promises/issues
- npm.io page: https://npm.io/package/load-promises

## Recent versions

- 2.0.2 (latest) — 2019-02-19
- 2.0.1 — 2018-11-30
- 1.0.0 — 2017-12-02

## README

# loadPromises

Expose the page load events as promises. Works in any browser that
[supports promises](https://caniuse.com/#feat=promises), or that has a
compatible polyfill.

## Install

With NPM

```
$ npm install load-promises
```

With Yarn

```
$ yarn add load-promises
```

## Usage

With webpack. The package has a `module` field. Tree shaking is possible if you
only use one of the events.

```js
import { DOMContentLoaded, windowLoad } from 'load-promises';

// Equivalent of $(document).ready();
DOMContentLoaded().then(() => {
  // ...
});

// Equivalent of $(window).load();
windowLoad().then(() => {
  // ...
});
```

In a browser. Both promises are namespaced in `loadPromises`

```html
<html>
  <head>
    <script src="loadPromises.umd.js"></script>
    <script>
      // Equivalent of $(document).ready();
      loadPromises.DOMContentLoaded().then(function() {
        // ...
      });

      // Equivalent of $(window).load();
      loadPromises.windowLoad().then(function() {
        // ...
      });
    </script>
  </head>
  <body></body>
</html>
```

---
_Source: https://npm.io/package/load-promises · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
