Comparing version 2.0.0 to 3.0.0
@@ -8,8 +8,6 @@ /** | ||
``` | ||
import domLoaded = require('dom-loaded'); | ||
import domLoaded from 'dom-loaded'; | ||
(async () => { | ||
await domLoaded; | ||
console.log('The DOM is now loaded.'); | ||
})(); | ||
await domLoaded; | ||
console.log('The DOM is now loaded.'); | ||
``` | ||
@@ -19,6 +17,6 @@ */ | ||
/** | ||
Synchronously check if the DOM has already finished loaded. | ||
Synchronously check if the DOM has already finished loading. | ||
``` | ||
import domLoaded = require('dom-loaded'); | ||
import domLoaded from 'dom-loaded'; | ||
@@ -30,5 +28,5 @@ if (domLoaded.hasLoaded) { | ||
*/ | ||
hasLoaded: boolean; | ||
readonly hasLoaded: boolean; | ||
}; | ||
export = domLoaded; | ||
export default domLoaded; |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const hasLoaded = () => document.readyState === 'interactive' || document.readyState === 'complete'; | ||
@@ -19,6 +17,6 @@ | ||
export default domLoaded; | ||
Object.defineProperty(domLoaded, 'hasLoaded', { | ||
get: () => hasLoaded() | ||
}); | ||
module.exports = domLoaded; |
{ | ||
"name": "dom-loaded", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Check when the DOM has loaded like `DOMContentLoaded`", | ||
"license": "MIT", | ||
"repository": "sindresorhus/dom-loaded", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=12" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
"// TODO: Enable when JSOM support ESM - test": "xo && ava && tsd", | ||
"test": "xo && tsd" | ||
}, | ||
@@ -27,3 +31,2 @@ "files": [ | ||
"ready", | ||
"doc", | ||
"complete", | ||
@@ -36,6 +39,6 @@ "check", | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"jsdom": "^14.0.0", | ||
"tsd": "^0.7.1", | ||
"xo": "^0.24.0" | ||
"ava": "^3.15.0", | ||
"jsdom": "^16.5.3", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.39.1" | ||
}, | ||
@@ -42,0 +45,0 @@ "xo": { |
@@ -1,2 +0,2 @@ | ||
# dom-loaded [![Build Status](https://travis-ci.org/sindresorhus/dom-loaded.svg?branch=master)](https://travis-ci.org/sindresorhus/dom-loaded) | ||
# dom-loaded | ||
@@ -7,3 +7,2 @@ > Check when the DOM has loaded like [`DOMContentLoaded`](https://developer.mozilla.org/en/docs/Web/Events/DOMContentLoaded) | ||
## Install | ||
@@ -15,15 +14,11 @@ | ||
## Usage | ||
```js | ||
const domLoaded = require('dom-loaded'); | ||
import domLoaded from 'dom-loaded'; | ||
(async () => { | ||
await domLoaded; | ||
console.log('The DOM is now loaded.'); | ||
})(); | ||
await domLoaded; | ||
console.log('The DOM is now loaded.'); | ||
``` | ||
## API | ||
@@ -41,7 +36,6 @@ | ||
Synchronously check if the DOM has already finished loaded. | ||
Synchronously check if the DOM has already finished loading. | ||
## Related | ||
- [element-ready](https://github.com/sindresorhus/element-ready) - Detect when an element is ready in the DOM |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Yes
3919
41
39