@leafer-ui/miniapp 1.4.1 → 1.4.2

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.
@@ -3635,7 +3635,12 @@ const Resource = {
3635
3635
  return R.map[key];
3636
3636
  },
3637
3637
  remove(key) {
3638
- delete R.map[key];
3638
+ const r = R.map[key];
3639
+ if (r) {
3640
+ if (r.destroy)
3641
+ r.destroy();
3642
+ delete R.map[key];
3643
+ }
3639
3644
  },
3640
3645
  loadImage(key, format) {
3641
3646
  return new Promise((resolve, reject) => {
@@ -3661,6 +3666,7 @@ const Resource = {
3661
3666
  const R = Resource;
3662
3667
 
3663
3668
  const ImageManager = {
3669
+ maxRecycled: 100,
3664
3670
  recycledList: [],
3665
3671
  patternTasker: new TaskProcessor(),
3666
3672
  get(config) {
@@ -3677,13 +3683,8 @@ const ImageManager = {
3677
3683
  },
3678
3684
  clearRecycled() {
3679
3685
  const list = I$1.recycledList;
3680
- if (list.length > 100) {
3681
- list.forEach(image => {
3682
- if (!image.use && image.url) {
3683
- Resource.remove(image.url);
3684
- image.destroy();
3685
- }
3686
- });
3686
+ if (list.length > I$1.maxRecycled) {
3687
+ list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
3687
3688
  list.length = 0;
3688
3689
  }
3689
3690
  },
@@ -6051,7 +6052,7 @@ class LeafLevelList {
6051
6052
  }
6052
6053
  }
6053
6054
 
6054
- const version = "1.4.1";
6055
+ const version = "1.4.2";
6055
6056
 
6056
6057
  class LeaferCanvas extends LeaferCanvasBase {
6057
6058
  get allowBackgroundColor() { return false; }