index.js
function pickTemplate(templateName) {
        if (templateName === THE_ONLY_TEMPLATE)
            return theOnlyTemplate.promise;
        if (registry.hasOwnProperty(templateName))
            return registry[templateName].promise;
        if (registryComplete)
            throw noSuchTemplate(templateName);
        return (registry[templateName] = new Deferred()).promise;
    }
function pickTemplate(templateName) {
        if (templateName === THE_ONLY_TEMPLATE)
            return theOnlyTemplate.promise;
        if (registry.hasOwnProperty(templateName))
            return registry[templateName].promise;
        if (registryComplete)
            throw noSuchTemplate(templateName);
        return (registry[templateName] = new Deferred()).promise;
    }
Choose template for the given template name; returns a promise