Raanan Weber 7 anni fa
parent
commit
f2a6a13ee1

File diff suppressed because it is too large
+ 10 - 10
dist/preview release/viewer/babylon.viewer.js


+ 32 - 5
dist/preview release/viewer/babylon.viewer.max.js

@@ -93272,6 +93272,9 @@ var MapperManager = (function () {
     MapperManager.prototype.registerMapper = function (type, mapper) {
         this.mappers[type] = mapper;
     };
+    MapperManager.prototype.dispose = function () {
+        this.mappers = {};
+    };
     MapperManager.DefaultMapper = 'json';
     return MapperManager;
 }());
@@ -93356,6 +93359,11 @@ var ViewerManager = (function () {
         this.onViewerAdded && this.onViewerAdded(viewer);
         this.onViewerAddedObservable.notifyObservers(viewer);
     };
+    ViewerManager.prototype.dispose = function () {
+        for (var id in this.viewers) {
+            this.viewers[id].dispose();
+        }
+    };
     return ViewerManager;
 }());
 exports.ViewerManager = ViewerManager;
@@ -94602,6 +94610,11 @@ function init(event) {
         return;
     initializer_1.InitTags();
 }
+function disposeAll() {
+    viewerManager_1.viewerManager.dispose();
+    mappers_1.mapperManager.dispose();
+}
+exports.disposeAll = disposeAll;
 
 
 /***/ }),
@@ -94742,6 +94755,7 @@ var TemplateManager = (function () {
             _this.templates[template].dispose();
         });
         this.templates = {};
+        this.eventManager.dispose();
         this.onInit.clear();
         this.onAllLoaded.clear();
         this.onEventTriggered.clear();
@@ -95078,6 +95092,9 @@ var EventManager = (function () {
             callbackDef.callback(data);
         });
     };
+    EventManager.prototype.dispose = function () {
+        this.callbacksContainer = {};
+    };
     return EventManager;
 }());
 exports.EventManager = EventManager;
@@ -95095,7 +95112,9 @@ var types_1 = __webpack_require__(23);
 var deepmerge = __webpack_require__(13);
 var babylonjs_1 = __webpack_require__(0);
 var ConfigurationLoader = (function () {
-    function ConfigurationLoader() {
+    function ConfigurationLoader(_enableCache) {
+        if (_enableCache === void 0) { _enableCache = false; }
+        this._enableCache = _enableCache;
         this.configurationCache = {};
         this.loadRequests = [];
     }
@@ -95154,11 +95173,21 @@ var ConfigurationLoader = (function () {
     ConfigurationLoader.prototype.loadFile = function (url) {
         var _this = this;
         var cacheReference = this.configurationCache;
-        if (cacheReference[url]) {
+        if (this._enableCache && cacheReference[url]) {
             return Promise.resolve(cacheReference[url]);
         }
         return new Promise(function (resolve, reject) {
-            var fileRequest = babylonjs_1.Tools.LoadFile(url, resolve, undefined, undefined, false, function (request, error) {
+            var fileRequest = babylonjs_1.Tools.LoadFile(url, function (result) {
+                var idx = _this.loadRequests.indexOf(fileRequest);
+                if (idx !== -1)
+                    _this.loadRequests.splice(idx, 1);
+                if (_this._enableCache)
+                    cacheReference[url] = result;
+                resolve(result);
+            }, undefined, undefined, false, function (request, error) {
+                var idx = _this.loadRequests.indexOf(fileRequest);
+                if (idx !== -1)
+                    _this.loadRequests.splice(idx, 1);
                 reject(error);
             });
             _this.loadRequests.push(fileRequest);
@@ -95167,8 +95196,6 @@ var ConfigurationLoader = (function () {
     return ConfigurationLoader;
 }());
 exports.ConfigurationLoader = ConfigurationLoader;
-exports.configurationLoader = new ConfigurationLoader();
-exports.default = exports.configurationLoader;
 
 
 /***/ }),