Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-element-resize-detector

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-element-resize-detector

The default blueprint for ember-cli addons.

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

ember-element-resize-detector

Build Status npm version Code Climate Dependency Status

Features

Installation

ember install ember-element-resize-detector
  • Live Demo

  • Changelog

Usage

This addon provides a resize-detector service and a {{resize-detector}} component.

Component

This component allows you to specify what element should be monitored for change and what action should be triggered.

{{resize-detector '#my-container' on-resize=(action 'resize')}}
<div id="my-container"></div>
ResizeDetector#selector

jQuery CSS selector for an element that should be watched.

ResizeDetector#on-resize

Action to be triggered when resized. The action handler will receive a hash with width and height as well as the element that changed sizes.

Service

The service allows you to create components that monitor sizes of other DOM elements. To use the service in you need to inject into the component and add a listener.

To see a complete implementation, look at the {{resize-detector}} component's code.

The service provides two methods.

ResizeDetectorService#setup(selector, callback)

Will add a listener that'll trigger the callback when the element matching the selector changes in size.

Selector is jQuery selector that'll match the element. The detector will only watch the first matched element. I would recommend creating callbacks using Ember.run.bind to ensure that the runloop is started when the callback is called.

ResizeDetectorService#teardown(selector, callback)

Will remove the listener from element matching selector for given callback.

Looking for help?

If it is a bug please open an issue on GitHub.

Nested Addons (or using this addon inside of an addon)

To use this addon as a dependency of another addon, you must specify this addon as a peerDependency of your addon. This will cause the host app that's installing your addon to also install this addon in the root node_modules. For more formation, read comment in ember-tether library.

Credits

This addon uses wnr/element-resize-detector library. Lucas Wiener thank you for doing the hard to work make this performant.

Keywords

FAQs

Package last updated on 03 Dec 2018

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