Skip to content

Instantly share code, notes, and snippets.

@courthead
Created December 23, 2015 23:18
Show Gist options
  • Save courthead/8134377fe7b5c0c202f7 to your computer and use it in GitHub Desktop.
Save courthead/8134377fe7b5c0c202f7 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export function optionalFunction(orderedArgs/*, namedArgs*/) {
const actionFn = orderedArgs[0];
return function (event) {
return actionFn ? actionFn(event) : undefined;
};
}
export default Ember.Helper.helper(optionalFunction);
{{some-component some-action=(action (optional-function attrs.someFunc))}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment