@galacean/engine 0.9.19 → 0.9.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -22946,18 +22946,10 @@
22946
22946
  var _config_type;
22947
22947
  config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
22948
22948
  var realRequest = config.type === "image" ? requestImage : requestRes;
22949
- var lastError;
22950
22949
  var executor = new MultiExecutor(function() {
22951
- return realRequest(url, config).onProgress(setProgress).then(function(res) {
22952
- resolve(res);
22953
- executor.stop();
22954
- }).catch(function(err) {
22955
- return lastError = err;
22956
- });
22950
+ return realRequest(url, config).onProgress(setProgress);
22957
22951
  }, retryCount, retryInterval);
22958
- executor.start(function() {
22959
- reject(lastError);
22960
- });
22952
+ executor.start().onError(reject).onComplete(resolve);
22961
22953
  });
22962
22954
  }
22963
22955
  function requestImage(url, config) {
@@ -23044,23 +23036,33 @@
23044
23036
  this.exec = this.exec.bind(this);
23045
23037
  };
23046
23038
  var _proto = MultiExecutor.prototype;
23047
- _proto.start = function start(done) {
23048
- this.done = done;
23039
+ _proto.start = function start() {
23049
23040
  this.exec();
23041
+ return this;
23050
23042
  };
23051
- _proto.stop = function stop() {
23052
- clearTimeout(this._timeoutId);
23043
+ _proto.onComplete = function onComplete(func) {
23044
+ this._onComplete = func;
23045
+ return this;
23046
+ };
23047
+ _proto.onError = function onError(func) {
23048
+ this._onError = func;
23049
+ return this;
23050
+ };
23051
+ _proto.cancel = function cancel() {
23052
+ window.clearTimeout(this._timeoutId);
23053
23053
  };
23054
23054
  _proto.exec = function exec() {
23055
23055
  var _this = this;
23056
23056
  if (this._currentCount >= this.totalCount) {
23057
- this.done && this.done();
23057
+ this._onError && this._onError(this._error);
23058
23058
  return;
23059
23059
  }
23060
23060
  this._currentCount++;
23061
- this.execFunc(this._currentCount).then(function() {
23062
- //@ts-ignore
23063
- _this._timeoutId = setTimeout(_this.exec, _this.interval);
23061
+ this.execFunc(this._currentCount).then(function(result) {
23062
+ return _this._onComplete && _this._onComplete(result);
23063
+ }).catch(function(e) {
23064
+ _this._error = e;
23065
+ _this._timeoutId = window.setTimeout(_this.exec, _this.interval);
23064
23066
  });
23065
23067
  };
23066
23068
  return MultiExecutor;
@@ -34397,8 +34399,14 @@
34397
34399
  }
34398
34400
  });
34399
34401
  GLTFParser.defaultPipeline.parse(context).then(masterPromiseInfo.resolve).catch(function(e) {
34400
- console.error(e);
34401
- masterPromiseInfo.reject("Error loading glTF model from " + url + " .");
34402
+ var msg = "Error loading glTF model from " + url + " .";
34403
+ Logger.error(msg);
34404
+ masterPromiseInfo.reject(msg);
34405
+ context.defaultSceneRootPromiseInfo.reject(e);
34406
+ context.texturesPromiseInfo.reject(e);
34407
+ context.materialsPromiseInfo.reject(e);
34408
+ context.meshesPromiseInfo.reject(e);
34409
+ context.animationClipsPromiseInfo.reject(e);
34402
34410
  });
34403
34411
  return context.promiseMap;
34404
34412
  };
@@ -35927,7 +35935,7 @@
35927
35935
  decode(data, resourceManager.engine).then(function(mesh) {
35928
35936
  resolve(mesh);
35929
35937
  });
35930
- });
35938
+ }).catch(reject);
35931
35939
  });
35932
35940
  };
35933
35941
  return MeshLoader;
@@ -35945,14 +35953,14 @@
35945
35953
  var _proto = EditorTextureLoader.prototype;
35946
35954
  _proto.load = function load(item, resourceManager) {
35947
35955
  var _this = this;
35948
- return new AssetPromise(function(resolve) {
35956
+ return new AssetPromise(function(resolve, reject) {
35949
35957
  _this.request(item.url, {
35950
35958
  type: "arraybuffer"
35951
35959
  }).then(function(data) {
35952
35960
  decode(data, resourceManager.engine).then(function(texture) {
35953
35961
  resolve(texture);
35954
35962
  });
35955
- });
35963
+ }).catch(reject);
35956
35964
  });
35957
35965
  };
35958
35966
  return EditorTextureLoader;
@@ -36382,7 +36390,7 @@
36382
36390
  }));
36383
36391
 
36384
36392
  //@ts-ignore
36385
- var version = "0.9.19";
36393
+ var version = "0.9.20";
36386
36394
  console.log("Galacean engine version: " + version);
36387
36395
  for(var key in CoreObjects){
36388
36396
  Loader.registerClass(key, CoreObjects[key]);