resize-observer-polyfill
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -0,1 +1,4 @@ | ||
/** | ||
* @deprecated Global version of the polyfill is deprecated and will be removed in the next major release. | ||
*/ | ||
import ResizeObserver from './src/ResizeObserver'; | ||
@@ -2,0 +5,0 @@ |
{ | ||
"name": "resize-observer-polyfill", | ||
"author": "Denis Rul <que.etc@bgmail.com>", | ||
"version": "1.2.1", | ||
"author": "Denis Rul <que.etc@gmail.com>", | ||
"version": "1.3.0", | ||
"description": "A polyfill for the Resize Observer API", | ||
"main": "dist/ResizeObserver.js", | ||
"jsnext:main": "index.js", | ||
"module": "index.js", | ||
"jsnext:main": "dist/ResizeObserver.es.js", | ||
"module": "dist/ResizeObserver.es.js", | ||
"scripts": { | ||
"test": "gulp test:lint && karma start karma.config.js --browsers Firefox", | ||
"gulp": "gulp" | ||
"test:lint": "eslint **/*.js --ignore-pattern dist/*", | ||
"test:spec": "karma start", | ||
"test:spec:custom": "karma start --mode custom", | ||
"test:spec:native": "karma start --mode custom --native", | ||
"test": "npm run test:lint && npm run test:spec", | ||
"build": "rollup -c" | ||
}, | ||
@@ -42,26 +46,21 @@ "repository": { | ||
"devDependencies": { | ||
"babel-core": "^6.9.1", | ||
"babel-eslint": "^7.0.0", | ||
"babel-core": "^6.20.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-plugin-external-helpers": "^6.18.0", | ||
"babel-polyfill": "^6.16.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-polyfill": "^6.20.0", | ||
"babel-preset-latest": "^6.16.0", | ||
"eslint": "^3.8.1", | ||
"gulp": "^3.9.1", | ||
"gulp-eslint": "^3.0.1", | ||
"jasmine-core": "^2.4.0", | ||
"karma": "^1.2.0", | ||
"eslint": "^3.12.2", | ||
"jasmine-core": "^2.5.2", | ||
"karma": "^1.3.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-jasmine-html-reporter": "^0.2.1", | ||
"karma-jasmine": "^1.1.0", | ||
"karma-jasmine-html-reporter": "^0.2.2", | ||
"karma-rollup-plugin": "^0.2.4", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-spec-reporter": "0.0.26", | ||
"lodash": "^4.13.1", | ||
"rollup": "^0.36.3", | ||
"rollup-plugin-babel": "^2.6.1", | ||
"rollup-plugin-uglify": "^1.0.1" | ||
"rollup": "^0.37.0", | ||
"rollup-plugin-babel": "^2.7.1" | ||
} | ||
} |
@@ -9,5 +9,5 @@ ResizeObserver Polyfill | ||
Implementation is based on the MutationObserver (no polling unless DOM changes) with a fall back to a continuous dirty checking cycle if the first one is not supported. Handles non-delayed CSS transitions/animations and can optionally observe resizing of a `<textarea>` element along with changes caused by the `:hover` pseudo-class. | ||
Implementation is based on the MutationObserver (no polling unless DOM changes) with a fall back to a continuous dirty checking cycle if the first one is not supported. Doesn't modify observed elements. Handles non-delayed CSS transitions/animations and can optionally observe resizing of a `<textarea>` element along with changes caused by the `:hover` pseudo-class. | ||
Compliant with the [spec](http://rawgit.com/WICG/ResizeObserver/master/index.html) and the native implementation. Doesn't contain any publicly available methods except for those described in spec. The size is _3.0kb_ when minified and gzipped. | ||
Compliant with the [spec](http://rawgit.com/WICG/ResizeObserver/master/index.html) and the native implementation. The size is _3.0kb_ when minified and gzipped. | ||
@@ -47,3 +47,2 @@ [Live demo](http://que-etc.github.io/resize-observer-polyfill) (has style problems in IE10 and lower). | ||
### Local export | ||
It's recommended to use this library in the form of the [ponyfill](https://github.com/sindresorhus/ponyfill), which doesn't inflict modifications of the global object. | ||
@@ -66,21 +65,13 @@ | ||
``` | ||
Though you always can extend the global object manually if you need it. | ||
Package's main file is a ES5 [UMD](https://github.com/umdjs/umd) module and it will be dynamically substituted by the ES6 version for those bundlers that are aware of the [jnext:main](https://github.com/rollup/rollup/wiki/jsnext:main) or `module` fields, e.g. for [Rollup](https://github.com/rollup/rollup). | ||
In case you want to specify which version to use, you can either take `resize-observer-polyfill/index` for ES6 modules or `resize-observer-polyfill/dist/ResizeObserver` for UMD. | ||
### Global export | ||
Use following versions if you want polyfill to extend global object. | ||
ES6 module: | ||
```javascript | ||
import 'resize-observer-polyfill/index.global'; | ||
import ResizeObserver from 'resize-observer-polyfill'; | ||
const ro = new ResizeObserver(() => {}); | ||
window.ResizeObserver = ResizeObserver; | ||
``` | ||
UMD version: `resize-observer-polyfill/dist/ResizeObserver.global`. | ||
Package's main file is a ES5 [UMD](https://github.com/umdjs/umd) module and it will be dynamically substituted by the ES6 version for those bundlers that are aware of the [jnext:main](https://github.com/rollup/rollup/wiki/jsnext:main) or `module` fields, e.g. for [Rollup](https://github.com/rollup/rollup) or [Webpack 2](https://webpack.js.org/). | ||
You can also take minified bundles: `ResizeObserver.min.js` or `ResizeObserver.global.min.js`. | ||
**Note**: global versions (`index.global` and `dist/ResizeObserver.global`) are deprecated and will be removed in the next major release. | ||
@@ -93,3 +84,3 @@ ## Configuration | ||
By default things like resizing of a `<textarea>` element, changes caused by the CSS `:hover` pseudo-class and delayed CSS transitions are not tracked. To handle them you can set `ResizeObserver.continuousUpdates = true` which in turn will start a continuous update cycle which runs every `100` milliseconds (as a RAF callback, of course). Keep in mind that this is going to affect the performance. | ||
By default things like resizing of a `<textarea>` element, changes caused by the CSS `:hover` pseudo-class and delayed CSS transitions are not tracked. To handle them you can set `ResizeObserver.continuousUpdates = true` which in turn will start a continuous update cycle which runs every `100` milliseconds (as a RAF callback). Keep in mind that this is going to affect the performance. | ||
@@ -100,8 +91,6 @@ **NOTE:** changes made to this property affect all existing and future instances of ResizeObserver. | ||
First make sure that you have all dependencies installed by running `npm install`. Then you can execute following tasks either with a gulp CLI or with the `npm run gulp` command. | ||
To build polyfill. Creates UMD bundle in the `dist` folder: | ||
To build polyfill. This will create UMD bundles in the `dist` folder: | ||
```sh | ||
gulp build | ||
npm run build | ||
``` | ||
@@ -111,8 +100,8 @@ | ||
```sh | ||
gulp test:lint | ||
npm run test:lint | ||
``` | ||
Functional tests for all available browsers defined in `karma.config.js` file: | ||
Running unit tests: | ||
```sh | ||
gulp test:spec | ||
npm run test:spec | ||
``` | ||
@@ -122,3 +111,3 @@ | ||
```sh | ||
gulp test:spec:custom | ||
npm run test:spec:custom | ||
``` | ||
@@ -128,3 +117,3 @@ | ||
```sh | ||
gulp test:spec:native | ||
npm run test:spec:native | ||
``` | ||
@@ -131,0 +120,0 @@ |
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
18
3706
150285
18
117