
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@nlfurniss/ember-route-action-helper
Advanced tools
Credit: @rwjblue's jsbin
Demo: http://jsbin.com/jipani/edit?html,js,output
ember install ember-route-action-helper
The route-action helper allows you to bubble closure actions, which will delegate it to the currently active route hierarchy per the bubbling rules explained under actions. Like closure actions, route-action will also have a return value.
However, returning true in an action will not preserve bubbling semantics. In case you would like that behavior, you should use ordinary string actions instead.
For example, this route template tells the component to lookup the updateFoo action on the route when its internal clicked property is invoked, and curries the function call with 2 arguments.
{{! foo/route.hbs }}
{{foo-bar clicked=(route-action "updateFoo" "Hello" "world")}}
If the action is not found on the current route, it is bubbled up:
// application/route.js
import Ember from 'ember';
const { Route, set } = Ember;
export default Route.extend({
actions: {
updateFoo(...args) {
// handle action
return 42;
}
}
});
If no action is found after bubbling, an error will be raised. The route-action also has a return value:
// foo/component.js
import Ember from 'ember';
const { Component } = Ember;
export default Component.extend({
actions: {
anotherAction(...args) {
let result = this.get('updateFoo')(...args);
console.log(result); // 42
}
}
});
You may also use in conjunction with the {{action}} helper:
<button {{action (route-action 'updateFoo')}}>Update Foo</button>
This addon will work on Ember versions 1.13.x and up only, due to use of the new Helper implementation.
git clone this repositorynpm installbower installember servernpm test (Runs ember try:testall to test your addon against multiple Ember versions)ember testember test --serverThis helper is designed for use in controller templates, not in components. It will not, therefore, resolve route action references in an integration test. If you are using this helper in your components, you can override the helper using a pattern similar to the following:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import Ember from 'ember';
moduleForComponent('uses-route-action', 'Integration | Component | uses route action', {
integration: true,
beforeEach(assert) {
this.container
.registry
.registrations['helper:route-action'] = Ember.Helper.helper((arg) => {
return this.routeActions[arg];
});
this.routeActions = {
doSomething(arg) {
return Ember.RSVP.resolve({arg});
},
};
},
});
ember buildFor more information on using ember-cli, visit http://www.ember-cli.com/.
DockYard, Inc © 2015
FAQs
Bubble closure actions in routes
The npm package @nlfurniss/ember-route-action-helper receives a total of 46 weekly downloads. As such, @nlfurniss/ember-route-action-helper popularity was classified as not popular.
We found that @nlfurniss/ember-route-action-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.