@leafer-ui/worker 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.
package/dist/worker.js CHANGED
@@ -3638,7 +3638,12 @@ var LeaferUI = (function (exports) {
3638
3638
  return R.map[key];
3639
3639
  },
3640
3640
  remove(key) {
3641
- delete R.map[key];
3641
+ const r = R.map[key];
3642
+ if (r) {
3643
+ if (r.destroy)
3644
+ r.destroy();
3645
+ delete R.map[key];
3646
+ }
3642
3647
  },
3643
3648
  loadImage(key, format) {
3644
3649
  return new Promise((resolve, reject) => {
@@ -3664,6 +3669,7 @@ var LeaferUI = (function (exports) {
3664
3669
  const R = Resource;
3665
3670
 
3666
3671
  const ImageManager = {
3672
+ maxRecycled: 100,
3667
3673
  recycledList: [],
3668
3674
  patternTasker: new TaskProcessor(),
3669
3675
  get(config) {
@@ -3680,13 +3686,8 @@ var LeaferUI = (function (exports) {
3680
3686
  },
3681
3687
  clearRecycled() {
3682
3688
  const list = I$1.recycledList;
3683
- if (list.length > 100) {
3684
- list.forEach(image => {
3685
- if (!image.use && image.url) {
3686
- Resource.remove(image.url);
3687
- image.destroy();
3688
- }
3689
- });
3689
+ if (list.length > I$1.maxRecycled) {
3690
+ list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
3690
3691
  list.length = 0;
3691
3692
  }
3692
3693
  },
@@ -6054,7 +6055,7 @@ var LeaferUI = (function (exports) {
6054
6055
  }
6055
6056
  }
6056
6057
 
6057
- const version = "1.4.1";
6058
+ const version = "1.4.2";
6058
6059
 
6059
6060
  class LeaferCanvas extends LeaferCanvasBase {
6060
6061
  get allowBackgroundColor() { return true; }