Skip to content

Commit

Permalink
Merge pull request #5 from smithki/development
Browse files Browse the repository at this point in the history
Release v2.0.1
  • Loading branch information
smithki authored Aug 23, 2019
2 parents 1bea887 + 05cade6 commit 2e88091
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,27 @@ A cross-compatible [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web

## 🔗 Installation

Install via `yarn` (recommended):
Install via `yarn` or `npm`:

```sh
yarn add watch-resize
```

Install via `npm`:

```sh
npm install watch-resize
```

Don't forget the `peerDependencies`:

```sh
yarn add rxjs@~6.5.2
```

```sh
npm install rxjs@~6.5.2
```


## 🛠️ Usage

```ts
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "watch-resize",
"version": "2.0.0",
"version": "2.0.1",
"description": "Watch any DOM element for size changes using Observables.",
"author": "Ian K Smith <[email protected]>",
"license": "MIT",
Expand All @@ -19,8 +19,8 @@
"build": "npm-run-all -s clean:dist -p compile:*",
"compile:cjs": "microbundle build src/index.cjs.ts --format cjs --external rxjs",
"compile:umd": "microbundle build src/index.umd.ts --format umd --name watchResize --external rxjs",
"compile_watch:cjs": "microbundle watch src/index.cjs.ts --format cjs",
"compile_watch:umd": "microbundle watch src/index.umd.ts --format umd --name watchResize",
"compile_watch:cjs": "microbundle watch src/index.cjs.ts --format cjs --external none",
"compile_watch:umd": "microbundle watch src/index.umd.ts --format umd --name watchResize --external none",
"clean": "npm-run-all -s clean:*",
"clean:dist": "rimraf dist",
"clean:cache": "rimraf .rts2_cache_*",
Expand Down
3 changes: 2 additions & 1 deletion src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function watchResize<T extends HTMLElement>(
): Promise<[WatchResizeObservable<T>, DestroyWatchResizeObservable]> {
return new Promise((resolve, reject) => {
// Assert that `element` is defined and is a valid DOM node.
if (typeof element === 'undefined') {
if (typeof element === 'undefined' || element === null) {
reject('[watch-resize] The given element must be defined.');
}
if (!isElement(element)) {
Expand Down Expand Up @@ -118,6 +118,7 @@ export function watchResize<T extends HTMLElement>(

resolve([observable, destroy]);
} else {
destroy();
reject('[watch-resize] Failed to build a nested browsing context.');
}
});
Expand Down

0 comments on commit 2e88091

Please sign in to comment.