Skip to content

Commit

Permalink
Set main file to the UMD version
Browse files Browse the repository at this point in the history
  • Loading branch information
que-etc committed Nov 8, 2016
1 parent c2d6eee commit 8343dff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ResizeObserver Polyfill

A polyfill for the Resize Observer API.

Implementation is based on the MutationObserver (no polling unless DOM changes) with a fall back to a continuous dirty checking cycle if the latter 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. 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.

Expand Down Expand Up @@ -46,8 +46,6 @@ Polyfill has been tested and known to work in the following browsers:
### 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.

With ES6 modules:

```javascript
import ResizeObserver from 'resize-observer-polyfill';

Expand All @@ -64,7 +62,9 @@ const ro = new ResizeObserver((entries, observer) => {
ro.observe(document.body);
```

As a pre-built ES5 [UMD](https://github.com/umdjs/umd) version if ES6 is not your thing: `resize-observer-polyfill/dist/ResizeObserver`.
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.
Expand All @@ -87,7 +87,7 @@ You can also take minified bundles: `ResizeObserver.min.js` or `ResizeObserver.g

### continuousUpdates

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.continuousUpdtaes = 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, of course). Keep in mind that this is going to affect the performance.

**NOTE:** changes made to this property affect all existing and future instances of ResizeObserver.

Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"node",
"es6"
],
"version": "1.2.0",
"version": "1.2.1",
"main": [
"index.js"
"dist/ResizeObserver.js"
],
"keywords": [
"ResizeObserver",
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "resize-observer-polyfill",
"author": "Denis Rul <que.etc@bgmail.com>",
"version": "1.2.0",
"version": "1.2.1",
"description": "A polyfill for the Resize Observer API",
"main": "index.js",
"main": "dist/ResizeObserver.js",
"jsnext:main": "index.js",
"module": "index.js",
"scripts": {
"test": "gulp test:lint && karma start karma.config.js --browsers Firefox",
"gulp": "gulp"
Expand Down
2 changes: 1 addition & 1 deletion tests/ResizeObserver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ describe('ResizeObserver', () => {
elements.target2.style.width = '700px';
elements.target2.style.height = '350px';

await wait(550);
await wait(570);

const entries = spy.calls.mostRecent().args[0];

Expand Down

0 comments on commit 8343dff

Please sign in to comment.