Socket
Book a DemoInstallSign in
Socket

ember-component-action-bubbling

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-component-action-bubbling

Bubble actions in Ember components.

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Ember Component Action Bubbling

This addon allows you to call an action from a nested component and have it bubble up the hierarchy all the way to the root component, then on to the current controller, its route, eventually reaching the application route, simliar to how Controller and Route's send() works in Ember:

  • Bubbling will continue while actions along the chain keep returning true, until reaching the application route.

  • If a component along the chain does not implement the action, bubbling will skip to its parent.

The addon is very simple and all it does is reintroduce behaviour that was already present thanks to this lovely little bug.

Installation

  • ember install ember-component-action-bubbling

Code Example

// parent
export default Ember.Component.extend({
  actions: {
    say(something) {
      console.log('repeating', something); // stops here
    }
  }
});

// child
export default Ember.Component.extend({
  actions: {
    say(something) {
      console.log('saying', something);
      return true; // continues
    }
  }
});

// grand child
export default Ember.Component.extend({
  click() {
    this.bubble('say', 'Hello!');
  }
});

Demo

Check out this twiddle or the demo page.

Keywords

ember-addon

FAQs

Package last updated on 18 Sep 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.