Package Exports
- ember-invoke-action
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ember-invoke-action) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ember-invoke-action
A slightly more idiomatic way to invoke actions in your Ember components.
Installation
ember install ember-invoke-action
How To
You can either use ember-invoke-action
as a helper function or a mixin.
Mixin usage
import Ember from 'ember';
import { InvokeActionMixin } from 'ember-invoke-action';
export default Ember.Component.extend(InvokeActionMixin, {
click(...args) {
this.invokeAction('click', ...args);
}
});
Helper usage
import Ember from 'ember';
import { invokeAction } from 'ember-invoke-action';
export default Ember.Component.extend({
click(...args) {
invokeAction(this, 'click', ...args);
}
});
strictInvokeAction
As alternative to invokeAction
you can call strictInvokeAction
.
strictInvokeAction
is functionally the same as invokeAction
except for when
the given action could not be found, then strictInvokeAction
will raise an
AssertionError
.
Credits
This code was inspired by @miguelcobain, I just made an addon out of it.