# @busypixels/ngx-click-out

> A more performant way to trigger events when an element is clicked away from. By only initializing event listeners when an element is first interacted with, or whenever you so choose, preformance is greatly improved over other methods.

Latest version **0.3.2** (published 2022-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @busypixels/ngx-click-out
pnpm add @busypixels/ngx-click-out
yarn add @busypixels/ngx-click-out
bun add @busypixels/ngx-click-out
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2022-07-13 |
| First published | 2022-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 36 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | busypixels |

## Links

- npm: https://www.npmjs.com/package/@busypixels/ngx-click-out
- Repository: https://github.com/aharris/ngx-click-out
- Homepage: https://github.com/aharris/ngx-click-out#readme
- Issues: https://github.com/aharris/ngx-click-out/issues
- npm.io page: https://npm.io/package/@busypixels/ngx-click-out

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Recent versions

- 0.3.2 (latest) — 2022-07-13
- 0.3.1 — 2022-07-13
- 0.3.0 — 2022-07-09
- 0.2.3 — 2022-07-08
- 0.2.2 — 2022-07-08
- 0.2.1 — 2022-07-07
- 0.2.0 — 2022-07-07
- 0.1.0 — 2022-07-07
- 0.0.6 — 2022-07-06
- 0.0.5 — 2022-07-06
- 0.0.4 — 2022-07-06
- 0.0.3 — 2022-07-06
- 0.0.2 — 2022-07-06
- 0.0.1 — 2022-07-06

## README

# NG(X) Click Out

A more performant way to trigger events when an element is clicked away from. By only initializing event listeners when an element is first interacted with, or whenever you so choose, preformance is greatly improved over other methods.

## Installation

NPM: 

```
npm i @busypixels/ngx-click-out
```

Yarn: 

```
yarn add @busypixels/ngx-click-out
```

## Usage:

### Import the Module:

```ts
import { NgxClickOutModule } from '@busypixels/ngx-click-out';

@NgModule({
  ...
  imports: [
    ...
    NgxClickOutModule
    ...
  ],
  ...
})
export class AppModule { }
```

### Add the `out` event.

```html
  <div id="parent">
      <div id="inner-content" click-out (out)="handleClickOut()">
        Inner Content
      </div>
      <div id="outer-content">
        Outer Content
      </div>
  </div>
```

## Inputs

| Event     | Type     | Default                              | Description                         |
| --------- | -------- | ------------------------------------ | ----------------------------------- |
| inEvents  | string[] | `['click']`                          | Array of event names that will initialize `outEvents` |
| outEvents | string[] | `['click', 'touchstart', 'focusin']` | Array of event names that will fire the `out` event |

## Events

| Event  | description |
| ------ | ----------- |
| in     | Event fired when an element is initialized and ready to be clicked out of. |
| out    | Event fired when an initialized element is clicked outside of.             |


## Donate

If my work saves you time feel free to buy me a beer to keep it going. Cheers!


[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=CLJXYJ38HDE8Q)

---
_Source: https://npm.io/package/@busypixels/ngx-click-out · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
