# outside-clicky

> Listen for clicks outside of an element

Latest version **1.0.2** (published 2017-06-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install outside-clicky
pnpm add outside-clicky
yarn add outside-clicky
bun add outside-clicky
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-06-29 |
| First published | 2017-06-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jorrit Tinholt |
| Maintainers | dejorrit |

## Links

- npm: https://www.npmjs.com/package/outside-clicky
- Repository: https://github.com/dejorrit/outside-clicky
- Homepage: https://github.com/dejorrit/outside-clicky#readme
- Issues: https://github.com/dejorrit/outside-clicky/issues
- npm.io page: https://npm.io/package/outside-clicky

## Recent versions

- 1.0.2 (latest) — 2017-06-29
- 1.0.1 — 2017-06-29
- 1.0.0 — 2017-06-29

## README

# OutsideClicky

Listen for clicks outside of an element

## Install

```bash
npm install outside-clicky --save
```
    
## Usage

### Initializing OutsideClicky

```javascript
// Require OutsideClicky
const OutsideClicky = require('outside-clicky');
    
// Get the target element 
let myDiv = document.querySelector('.js-myDiv');
    
// Create a callback function that runs when you click outside of your target element
let myCallbackFunction = function () {
	console.log('You clicked outside myDiv');
};
    
// Initialize OutsideClicky
let myOC = new OutsideClicky();
```

### Binding the listener

```javascript
myOC.bind(myDiv, myCallbackFunction);
```

### Unbinding the listener

```javascript
myOC.unbind();
```

### Automatically unbind after outside click

```javascript
myOC.bind(myDiv, myCallbackFunction, true);
```

---
_Source: https://npm.io/package/outside-clicky · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
