7

It was mentioned here at SFSE (and following the examples in the Lightning Developer Guide it seems to confirm) that right now hardcoded namespace references are quite common or even necessary. As far as I have understood this is going to be improved in future releases.

But are there right now any intermediate best practices, tricks or workarounds to avoid as many hardcoded references as possible to keep the our code portable and decoupled from specific orgs?

Any ideas welcome.

5

Support for relative/current namespace refs (c:blah) is available in Spring '15 which will be hitting production soon. In markup you really do not have many options for minimizing the maintainable issue currently. We tried to get this in sooner but it was a bit tricker to layer on top of Aura than we had hoped.

FYI Spring '15 also supports non-namespaced orgs :-)

| improve this answer | |
  • Hi Doug, is spring '15 now helping also inside markup code to avoid hardcoded namespace references? – Uwe Heim Feb 25 '15 at 18:01
  • Yes, you should be able to use c: to refer to the current/custom namespace. NOTE: We have had a number of reports of some issues with c: interacting incorrectly on installs of packages that we are working on getting fixes out for asap in a patch to Spring '15. – Doug Chasman Feb 25 '15 at 22:30
3

This doesn't help for the markup in the components, but if you need to reference the namespace in JavaScript you can use the following:

var ns = component.getDef().getDescriptor().getNamespace();
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.