New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-click-outside

Package Overview
Dependencies
Maintainers
0
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-click-outside

The default blueprint for Embroider v2 addons.

  • 6.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
increased by26.27%
Maintainers
0
Weekly downloads
 
Created
Source

ember-click-outside Ember Observer Score

A handy modifier for detecting click events fired outside an element.

click outside logo

Compatibility

  • Ember.js v3.4 or above
  • Embroider or ember-auto-import v2

If you're running ember-source <3.22, you need to install ember-destroyable-polyfill to get the modifier working.

If you're running ember-source <3.8, you need to install ember-modifier-manager-polyfill to get the modifier working.

Installation

From within your ember-cli project directory install the addon:

ember install ember-click-outside

Usage

<div {{on-click-outside this.someAction}}>
  Your HTML...
</div>

If you wish to exclude certain elements from counting as outside clicks, use the exceptSelector attribute:

<div {{on-click-outside this.someAction exceptSelector=".some-selector"}}>
  Your HTML...
</div>

You can listen for events other than click by using the eventType attribute:

<div {{on-click-outside this.someAction eventType="mousedown"}}>
  Your HTML...
</div>

How it works?

For every click in the document, ember-click-outside will check if the click target is outside of its element, and trigger the provided action/callback if so.

If the click target cannot be found in the document (probably because it has been removed before ember-click-outside detected the click), no action/callback is triggered, since we cannot check if it is inside or outside of the element.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 05 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc