Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "async-raf", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Get async animation frame context", | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "jest", | ||
"release": "release-it", | ||
"prepublishOnly": "npm t" | ||
"prepublishOnly": "npm run build && npm t", | ||
"build": "babel index.js --out-dir lib && uglifyjs --compress --mangle --output lib/index.js -- lib/index.js" | ||
}, | ||
@@ -35,6 +36,11 @@ "files": [ | ||
"devDependencies": { | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.6", | ||
"@babel/plugin-transform-runtime": "^7.9.6", | ||
"@babel/preset-env": "^7.9.6", | ||
"@types/jest": "^25.1.2", | ||
"jest": "^25.1.0", | ||
"release-it": "^12.4.3" | ||
"release-it": "^12.4.3", | ||
"uglify-js": "^3.9.3" | ||
} | ||
} |
@@ -1,7 +0,30 @@ | ||
# async-raf | ||
Get async animation frame context | ||
# async-raf [](https://badge.fury.io/js/async-raf) | ||
_Get async animation frame context_ | ||
### Install | ||
`npm install --save async-raf` | ||
### Why? | ||
When you want to get a value from requestAnimationFrame, instead of: | ||
```javascript | ||
const area = await new Promise((resolve) => { | ||
window.requestAnimationFrame(() => { | ||
const { offsetWidth, offsetHeight } = someElement; | ||
resolve(offsetWidth * offsetHeight); | ||
}); | ||
}); | ||
``` | ||
You can use AsynRAF: | ||
```javascript | ||
const area = await asyncRaf(() => { | ||
const { offsetWidth, offsetHeight } = someElement; | ||
return offsetWidth * offsetHeight; | ||
}); | ||
``` | ||
### Usage | ||
@@ -8,0 +31,0 @@ ```javascript |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
5617
5
59
8
1