The right way to access Handlebars.helprs programatically

A component might need to use different Handlebars.helpers based on the provided property.

What is the right way for accessing Handlebars.helpers pragmatically from a component and rendering the value correctly?

This uses a view but the idea can still be applied to a component. There may be a better way of doing this, but this is my approach.

Your solution is interesting and works rather well! However, I was more interested in how to call that actual method that is being registered with the helper.

From your example

Ember.Handlebars.helper('foo', function(value, options) {
  var escaped = Handlebars.Utils.escapeExpression(value);
  return new Handlebars.SafeString('foooo ' + escaped);
});

What is the way to access that function that we pass after ‘foo’. This function:

function(value, options) {
  var escaped = Handlebars.Utils.escapeExpression(value);
  return new Handlebars.SafeString('foooo ' + escaped);
}

Ember.Handlebars.helpers.foo._rawFunction the underscore indicates you’re accessing a private… so tread lightly.

If you’re using EAK, you can always just import the helper function which is the approach I’ve taken in the past.

Nice! That is exactly what I was looking for.

Since this is a discussion forum I’d like to ask if anyone knows the design decision behind making _rawFunction private and not exposing it to the public API.