@ones-editor/editor 2.2.14-beta.11 → 2.2.14-beta.12

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/index.js CHANGED
@@ -81558,28 +81558,38 @@ ${content}
81558
81558
  return exclusiveBlock2;
81559
81559
  }
81560
81560
  }
81561
+ class TaskCache {
81562
+ constructor() {
81563
+ __publicField(this, "_cache", []);
81564
+ }
81565
+ checkCache(pro) {
81566
+ const index2 = this._cache.findIndex((p) => p.promise === pro);
81567
+ for (let i = 0; i < index2; i++) {
81568
+ this._cache[i].promiseHelper.isDelayComplete = true;
81569
+ }
81570
+ this._cache.splice(index2, 1);
81571
+ }
81572
+ addCache(pro, promiseHelper) {
81573
+ this._cache.push({ promise: pro, promiseHelper });
81574
+ }
81575
+ static createPromiseHelper() {
81576
+ return {
81577
+ isDelayComplete: false
81578
+ };
81579
+ }
81580
+ }
81561
81581
  const enhanceAsync = (asyncFunction) => {
81562
- const proCache = [];
81563
- const clearCache = (pro) => {
81564
- const index2 = proCache.findIndex((p) => p === pro);
81565
- proCache.splice(index2, 1);
81566
- };
81582
+ const taskCache = new TaskCache();
81567
81583
  return async function(...args) {
81568
- const promiseHelper = {
81569
- isEarlyExecute: () => false
81570
- };
81584
+ const promiseHelper = TaskCache.createPromiseHelper();
81571
81585
  const pro = asyncFunction.apply(this, [promiseHelper, ...args]);
81572
- proCache.push(pro);
81573
- promiseHelper.isEarlyExecute = () => {
81574
- const index2 = proCache.findIndex((p) => p === pro);
81575
- return index2 > 0;
81576
- };
81586
+ taskCache.addCache(pro, promiseHelper);
81577
81587
  try {
81578
81588
  const ret = await pro;
81579
- clearCache(pro);
81589
+ taskCache.checkCache(pro);
81580
81590
  return ret;
81581
81591
  } catch (error2) {
81582
- clearCache(pro);
81592
+ taskCache.checkCache(pro);
81583
81593
  throw error2;
81584
81594
  }
81585
81595
  };
@@ -81697,12 +81707,12 @@ ${content}
81697
81707
  if (!src) {
81698
81708
  try {
81699
81709
  const imgSrc2 = await this.code2ObjectUrl(code);
81700
- if (promiseHelper.isEarlyExecute()) {
81710
+ if (promiseHelper.isDelayComplete) {
81701
81711
  return;
81702
81712
  }
81703
81713
  (_b = this.drawHandler) == null ? void 0 : _b.updateDraw(imgSrc2);
81704
81714
  } catch (err) {
81705
- if (promiseHelper.isEarlyExecute()) {
81715
+ if (promiseHelper.isDelayComplete) {
81706
81716
  return;
81707
81717
  }
81708
81718
  (_c = this.drawHandler) == null ? void 0 : _c.createErrorContent();
@@ -88954,7 +88964,7 @@ ${data2.plantumlText}
88954
88964
  }
88955
88965
  }
88956
88966
  });
88957
- editor.version = "2.2.14-beta.11";
88967
+ editor.version = "2.2.14-beta.12";
88958
88968
  return editor;
88959
88969
  }
88960
88970
  function isDoc(doc2) {
@@ -89055,7 +89065,7 @@ ${data2.plantumlText}
89055
89065
  });
89056
89066
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
89057
89067
  OnesEditorToolbar.register(editor);
89058
- editor.version = "2.2.14-beta.11";
89068
+ editor.version = "2.2.14-beta.12";
89059
89069
  return editor;
89060
89070
  }
89061
89071
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.2.14-beta.11",
3
+ "version": "2.2.14-beta.12",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {