How to get a list of registered helpers?


#1

I wrote a custom resolver for retrieving precompiled templates/bundles (objects) via (sync) AJAX requests. Now, I wanted to stuff most of the templates which are not included in any bundle into a “misc” bundle to resolve them altogether.

During development I saw that the resolver is also requesting templates for helpers, as the ember-htmlbars submodule calls hasComponentOrTemplate in order to check if the requested curly brace instance is registered with component: or template:components/ name prefix and only looks up the helpers, if these requests to resolveTemplate fail.

So, if I could somehow get a list of registered helpers beforehand, I could prevent my resolver from firing this unnecessary requests and speed it up a little. The only way that I could think of getting this list is calling Ember.getOwner(application) in an initializer and getting the Object.keys from the returned owner.__container__ which I’ll then filter for helpers and inject into my template fetching service, but this seems very hacky to me. Is there any other option to get to the list of registered helpers?