Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

outy

souporserious4.6kMIT0.1.2

A simple way to listen for events outside of elements.

outside, outside-click, overlay, modal

readme

Outy

npm version

A simple way to listen for events outside of elements. Inspired by outside-click.

Install

yarn add outy

npm install outy --save

<script src="https://unpkg.com/outy/index.js"></script>
(UMD library exposed as `outy`)

Usage

const overlay = document.getElementById('#overlay')
const outsideTap = outy(overlay, ['click', 'touchend'], handleOutsideTap)

function handleOutsideTap() {
  // maybe close an overlay?
}

// cleanup later
outsideTap.remove()