Where to put Ember Framework configuration?


#1

I’d like to be able to override the default event for the action handler (reason below), but this is currently hardcoded to ‘click’ in the Ember source, https://github.com/emberjs/ember.js/blob/master/packages/ember-routing/lib/helpers/action.js#L301

I’ll submit a PR to change that hardcoded “click” to a property that can be configured, however, where should configuration like this go? One option is using the Ember ENV, eg.

var action = {
  eventName: hash.on || Ember.ENV.ACTION_HELPER_EVENT_NAME
};

Is using the Ember ENV for configuration like this the way to go? Or is there a better place to put this?

Reason for wanting the change.

When running on a touch device, I want the actions and links to be triggered on ‘touchEnd’. When running on a non touch device, I want the actions and links to be triggered on click.

I can get this behaviour with links by reopening the link view:

Ember.LinkView.reopen({
  eventName: ('ontouchstart' in document.documentElement) ? 'touchEnd' : 'click'
})

However, because the default eventName of the action helper is hardcoded in the source, I would need to override the helper or change all my actions in the code to do the lookup themselves:

<div {{action someAction on=App.actionHelperEventName}}>

Ideally, I’d be able to configure the default event name for the action helper.