MDL-63714 core: Wrap doRender in pendingjs
[moodle.git] / lib / amd / src / templates.js
index dd49428..21fbed0 100644 (file)
@@ -509,6 +509,7 @@ define(['core/mustache',
         this.currentThemeName = themeName;
         var iconTemplate = iconSystem.getTemplateName();
 
+        M.util.js_pending('core/templates:doRender');
         return this.getTemplate(iconTemplate).then(function() {
             this.addHelpers(context, themeName);
             var result = mustache.render(templateSource, context, this.partialHelper.bind(this));
@@ -553,7 +554,11 @@ define(['core/mustache',
             }
 
             return $.Deferred().resolve(html, js).promise();
-        }.bind(this));
+        }.bind(this))
+        .then(function(html, js) {
+            M.util.js_complete('core/templates:doRender');
+            return $.Deferred().resolve(html, js).promise();
+        });
     };
 
     /**