raf-throttle
Advanced tools
Comparing version 1.1.1 to 2.0.0
@@ -5,2 +5,13 @@ ## [HEAD] | ||
## [V2.0.0] | ||
> March 15, 2015 | ||
- Support for UMD build. Now we can use rafThrottle from CDN. ✌️ | ||
- __Breaking:__ Remove `raf` dependency. You will need to add polyfill for it, if you want to support old browsers. | ||
[v1.1.1]: https://github.com/wuct/raf-throttle/compare/v2.0.0...v1.1.1 | ||
## [v1.1.1] | ||
@@ -7,0 +18,0 @@ > April 16, 2016 |
{ | ||
"name": "raf-throttle", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "Throttle a function by requestAnimationFrame", | ||
"main": "lib/index.js", | ||
"main": "lib/rafThrottle.js", | ||
"scripts": { | ||
"test": "ava --timeout 10000", | ||
"test:coverage": "nyc npm test", | ||
"coverage": "nyc report --reporter=text-lcov | codecov", | ||
"build": "NODE_ENV=production babel index.js --out-dir lib", | ||
"coverage": "nyc report --reporter=lcov > coverage.lcov && codecov", | ||
"clean": "rm -rf lib & rm -rf umd", | ||
"build:CommonJS": "NODE_ENV=production babel --out-dir lib rafThrottle.js", | ||
"build:UMD": "mkdir umd && NODE_ENV=umd babel --out-file umd/rafThrottle.min.js rafThrottle.js", | ||
"build": "npm run build:CommonJS & npm run build:UMD", | ||
"prebuild": "npm run clean", | ||
"prepublish": "npm run build" | ||
@@ -29,14 +33,15 @@ }, | ||
"devDependencies": { | ||
"ava": "^0.14.0", | ||
"ava": "^0.18.1", | ||
"babel-cli": "^6.7.5", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-es2015-modules-umd": "^6.24.0", | ||
"babel-preset-babili": "0.0.12", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-register": "^6.6.5", | ||
"codecov.io": "^0.1.6", | ||
"nyc": "^6.1.1", | ||
"sinon": "^1.17.3" | ||
"codecov": "^2.0.1", | ||
"nyc": "^10.0.0", | ||
"raf": "^3.2.0", | ||
"sinon": "^2.0.0" | ||
}, | ||
"dependencies": { | ||
"raf": "^3.2.0" | ||
}, | ||
"ava": { | ||
@@ -43,0 +48,0 @@ "files": [ |
@@ -14,6 +14,22 @@ # raf-throttle | ||
### npm | ||
`npm install raf-throttle --save` | ||
### yarn | ||
`yarn add raf-throttle` | ||
### CDN | ||
Download the file from [https://unpkg.com/raf-throttle/umd/rafThrottle.min.js](), | ||
and consume it from global as `rafThrottle`. | ||
## Usage | ||
### Polyfill | ||
Since [most of browsers](http://caniuse.com/#feat=requestanimationframe) support `requestAnimationFrame` by default, you can use `raf-throttle` directly. However, if you want to support old browsers, you will need to polyfill `requestAnimationFrame` by youself. One option is using [`raf`](https://www.npmjs.com/package/raf). | ||
### Example | ||
@@ -67,3 +83,3 @@ | ||
```js | ||
const throttled = throttle(foo) | ||
const throttled = throttle(foo) | ||
throttled() | ||
@@ -96,2 +112,1 @@ throttled.cancel() // foo would never be invoked | ||
## [LICENSE](LICENSE) | ||
Sorry, the diff of this file is not supported yet
8530
0
8
45
110
12
- Removedraf@^3.2.0
- Removedperformance-now@2.1.0(transitive)
- Removedraf@3.4.1(transitive)