浏览代码

if no templates were provided, onAllLoaded should be called

Raanan Weber 7 年之前
父节点
当前提交
78beaf3e5b
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      Viewer/src/templateManager.ts

+ 4 - 3
Viewer/src/templateManager.ts

@@ -92,9 +92,10 @@ export class TemplateManager {
         return this.buildHTMLTree(templates).then(htmlTree => {
             if (this.templates['main']) {
                 internalInit(htmlTree, 'main');
-                return true;
+            } else {
+                this.checkLoadedState();
             }
-            return false;
+            return;
         });
     }
 
@@ -144,7 +145,7 @@ export class TemplateManager {
     }
 
     private checkLoadedState() {
-        let done = Object.keys(this.templates).every((key) => {
+        let done = Object.keys(this.templates).length === 0 || Object.keys(this.templates).every((key) => {
             return this.templates[key].isLoaded && !!this.templates[key].parent;
         });