customer-chat-sdk 1.0.68 → 1.0.70

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.
@@ -14340,9 +14340,6 @@ class ScreenshotManager {
14340
14340
  this.scheduleNextFn = null;
14341
14341
  // 图片代理缓存(带过期时间)
14342
14342
  this.imageProxyCache = new Map();
14343
- // IndexedDB 缓存(持久化)
14344
- this.indexedDBCache = null;
14345
- this.indexedDBReady = false;
14346
14343
  // Intersection Observer(用于高效检测可见性)
14347
14344
  this.intersectionObserver = null;
14348
14345
  this.visibleElementsCache = new Set();
@@ -14377,13 +14374,10 @@ class ScreenshotManager {
14377
14374
  maxConcurrentDownloads: options.maxConcurrentDownloads ?? 10, // 增加并发数
14378
14375
  onlyVisibleImages: options.onlyVisibleImages ?? true, // 默认只处理可视区域
14379
14376
  imageCacheTTL: options.imageCacheTTL ?? 600000, // 默认10分钟(600000ms)
14380
- useIndexedDB: options.useIndexedDB ?? true, // 默认启用 IndexedDB 持久化缓存
14381
14377
  usePreconnect: options.usePreconnect ?? true, // 默认预连接代理服务器
14382
14378
  imageLoadTimeout: options.imageLoadTimeout ?? 5000, // 默认5秒超时
14383
14379
  useIntersectionObserver: options.useIntersectionObserver ?? true, // 默认使用 Intersection Observer
14384
14380
  fetchPriority: options.fetchPriority ?? 'high', // 默认高优先级
14385
- maxCacheSize: options.maxCacheSize ?? 50, // 默认最大50MB
14386
- maxCacheAge: options.maxCacheAge ?? 86400000, // 默认24小时(86400000ms)
14387
14381
  maxImageSize: options.maxImageSize ?? 5, // 不使用代理时,单个图片最大尺寸(MB),默认5MB
14388
14382
  skipLargeImages: options.skipLargeImages ?? true, // 不使用代理时,是否跳过过大的图片,默认true(跳过)
14389
14383
  workerNumber: options.workerNumber ?? undefined // modern-screenshot Worker 数量,默认自动计算(undefined 表示自动)
@@ -14406,15 +14400,6 @@ class ScreenshotManager {
14406
14400
  if (this.options.useIntersectionObserver && this.options.onlyVisibleImages) {
14407
14401
  this.initIntersectionObserver();
14408
14402
  }
14409
- // 初始化 IndexedDB(如果启用)
14410
- if (this.options.useIndexedDB) {
14411
- this.initIndexedDB().catch(() => {
14412
- // IndexedDB 初始化失败,回退到内存缓存
14413
- if (!this.options.silentMode) {
14414
- console.warn('📸 IndexedDB 初始化失败,使用内存缓存');
14415
- }
14416
- });
14417
- }
14418
14403
  }
14419
14404
  /**
14420
14405
  * 设置目标元素
@@ -14879,20 +14864,12 @@ class ScreenshotManager {
14879
14864
  if (this.options.preloadImages && this.options.enableCORS && selectedEngine === 'modern-screenshot') {
14880
14865
  // 清理过期缓存
14881
14866
  this.cleanExpiredCache();
14882
- // 如果启用 IndexedDB,也清理 IndexedDB 缓存
14883
- if (this.options.useIndexedDB) {
14884
- await this.cleanIndexedDBCache();
14885
- }
14886
14867
  await this.preprocessNetworkImages(this.targetElement);
14887
14868
  await this.waitForImagesToLoad(this.targetElement);
14888
14869
  }
14889
14870
  else {
14890
14871
  // 即使不预加载,也清理一下过期缓存
14891
14872
  this.cleanExpiredCache();
14892
- // 如果启用 IndexedDB,也清理 IndexedDB 缓存
14893
- if (this.options.useIndexedDB) {
14894
- await this.cleanIndexedDBCache();
14895
- }
14896
14873
  }
14897
14874
  let dataUrl;
14898
14875
  // 根据选择的引擎进行截图
@@ -15685,18 +15662,6 @@ class ScreenshotManager {
15685
15662
  }
15686
15663
  return cachedDataUrl;
15687
15664
  }
15688
- // 检查 IndexedDB 缓存(如果启用)
15689
- if (this.options.useIndexedDB) {
15690
- const indexedDBCache = await this.getIndexedDBCache(url);
15691
- if (indexedDBCache) {
15692
- // 同步到内存缓存
15693
- this.setCachedImage(url, indexedDBCache);
15694
- if (!this.options.silentMode) {
15695
- console.log(`📸 ✅ 使用 IndexedDB 缓存图片: ${url.substring(0, 50)}...`);
15696
- }
15697
- return indexedDBCache;
15698
- }
15699
- }
15700
15665
  try {
15701
15666
  // 构建代理请求参数
15702
15667
  const params = new URLSearchParams({
@@ -15736,10 +15701,6 @@ class ScreenshotManager {
15736
15701
  const dataUrl = await this.blobToDataUrl(blob);
15737
15702
  // 缓存结果(带时间戳,10分钟有效)
15738
15703
  this.setCachedImage(url, dataUrl);
15739
- // 如果启用 IndexedDB,也保存到 IndexedDB
15740
- if (this.options.useIndexedDB) {
15741
- await this.setIndexedDBCache(url, dataUrl);
15742
- }
15743
15704
  return dataUrl;
15744
15705
  }
15745
15706
  catch (fetchError) {
@@ -15772,18 +15733,6 @@ class ScreenshotManager {
15772
15733
  }
15773
15734
  return cachedDataUrl;
15774
15735
  }
15775
- // 检查 IndexedDB 缓存(如果启用)
15776
- if (this.options.useIndexedDB) {
15777
- const indexedDBCache = await this.getIndexedDBCache(url);
15778
- if (indexedDBCache) {
15779
- // 同步到内存缓存
15780
- this.setCachedImage(url, indexedDBCache);
15781
- if (!this.options.silentMode) {
15782
- console.log(`📸 ✅ 使用 IndexedDB 缓存图片(无代理模式): ${url.substring(0, 50)}...`);
15783
- }
15784
- return indexedDBCache;
15785
- }
15786
- }
15787
15736
  // 检查是否正在下载(避免重复下载)
15788
15737
  if (this.imageDownloadQueue.has(url)) {
15789
15738
  // 如果已经在下载队列中,等待现有下载完成
@@ -15911,14 +15860,10 @@ class ScreenshotManager {
15911
15860
  console.log(`📸 使用元素实际尺寸: ${elementWidth}x${elementHeight}`);
15912
15861
  }
15913
15862
  }
15914
- // 缩放配置:移动设备使用更低的缩放比例,进一步减少图片大小
15863
+ // 缩放配置:使用外部传递的参数
15915
15864
  // scale < 1 会降低图片分辨率,减少 base64 大小
15916
- if (this.options.scale !== 1) {
15917
- contextOptions.scale = isMobile ? 0.7 : this.options.scale; // 移动设备:0.8 -> 0.7
15918
- }
15919
- else if (isMobile) {
15920
- // 如果未指定 scale,移动设备默认使用 0.7
15921
- contextOptions.scale = 0.7;
15865
+ if (this.options.scale !== undefined && this.options.scale !== 1) {
15866
+ contextOptions.scale = this.options.scale;
15922
15867
  }
15923
15868
  // 优化:复用 context,避免频繁创建和销毁(性能提升 20%+)
15924
15869
  // 只在元素变化、配置变化或内容变化时重新创建 context
@@ -16116,28 +16061,83 @@ class ScreenshotManager {
16116
16061
  if (!this.options.silentMode) {
16117
16062
  console.log(`📸 使用 ${outputFormat.toUpperCase()} 格式截图(直接输出,无需转换)...`);
16118
16063
  }
16119
- // 根据输出格式选择对应的 API
16120
- // modern-screenshot 内部已经处理了超时,不需要额外的 Promise.race
16121
- if (outputFormat === 'webp') {
16122
- // 使用 domToWebp,直接输出 WebP 格式,无需转换
16123
- dataUrl = await domToWebp(this.screenshotContext);
16124
- }
16125
- else if (outputFormat === 'jpeg') {
16126
- // 使用 domToJpeg,直接输出 JPEG 格式,无需转换
16127
- dataUrl = await domToJpeg(this.screenshotContext);
16128
- }
16129
- else {
16130
- // 默认使用 domToPng
16131
- dataUrl = await domToPng(this.screenshotContext);
16132
- }
16133
- // 验证截图结果
16134
- if (!dataUrl || dataUrl.length < 100) {
16135
- throw new Error('生成的截图数据无效或过短');
16064
+ // 尝试使用 Worker 模式(context)
16065
+ try {
16066
+ // 根据输出格式选择对应的 API
16067
+ // modern-screenshot 内部已经处理了超时,不需要额外的 Promise.race
16068
+ if (outputFormat === 'webp') {
16069
+ // 使用 domToWebp,直接输出 WebP 格式,无需转换
16070
+ dataUrl = await domToWebp(this.screenshotContext);
16071
+ }
16072
+ else if (outputFormat === 'jpeg') {
16073
+ // 使用 domToJpeg,直接输出 JPEG 格式,无需转换
16074
+ dataUrl = await domToJpeg(this.screenshotContext);
16075
+ }
16076
+ else {
16077
+ // 默认使用 domToPng
16078
+ dataUrl = await domToPng(this.screenshotContext);
16079
+ }
16080
+ // 验证截图结果
16081
+ if (!dataUrl || dataUrl.length < 100) {
16082
+ throw new Error('生成的截图数据无效或过短');
16083
+ }
16084
+ if (!this.options.silentMode) {
16085
+ console.log(`📸 ✅ modern-screenshot 截图成功(Worker 模式,${outputFormat.toUpperCase()} 格式)`);
16086
+ }
16087
+ return dataUrl;
16136
16088
  }
16137
- if (!this.options.silentMode) {
16138
- console.log(`📸 modern-screenshot 截图成功(${outputFormat.toUpperCase()} 格式,直接输出,无需转换)`);
16089
+ catch (workerError) {
16090
+ // Worker 模式失败,回退到普通模式(参考用户代码)
16091
+ if (!this.options.silentMode) {
16092
+ console.warn('📸 Worker 模式失败,回退到普通模式:', workerError);
16093
+ }
16094
+ // 销毁失败的 context
16095
+ if (this.screenshotContext) {
16096
+ try {
16097
+ destroyContext(this.screenshotContext);
16098
+ }
16099
+ catch {
16100
+ // 忽略销毁错误
16101
+ }
16102
+ this.screenshotContext = null;
16103
+ }
16104
+ // 回退到普通模式(直接使用 domToWebp,不传 context)
16105
+ // 使用外部传递的参数,并给出合理的默认值
16106
+ const fallbackOptions = {
16107
+ scale: this.options.scale ?? 1, // 使用外部参数,默认 1
16108
+ backgroundColor: '#ffffff', // 默认白色背景
16109
+ type: `image/${outputFormat}`, // 使用配置的输出格式
16110
+ quality: this.options.quality ?? 0.8, // 使用外部参数,默认 0.4
16111
+ drawImageInterval: 20, // 默认 20ms,减少主线程阻塞
16112
+ features: {
16113
+ copyScrollbar: false,
16114
+ removeAbnormalAttributes: true,
16115
+ removeControlCharacter: true,
16116
+ fixSvgXmlDecode: true,
16117
+ restoreScrollPosition: false,
16118
+ },
16119
+ timeout: Math.max((this.options.interval ?? 5000) * 6, 10000), // 使用外部参数计算超时,默认 10 秒
16120
+ };
16121
+ // 限制 timeout 最多 15 秒
16122
+ fallbackOptions.timeout = Math.min(fallbackOptions.timeout, 15000);
16123
+ if (outputFormat === 'webp') {
16124
+ dataUrl = await domToWebp(element, fallbackOptions);
16125
+ }
16126
+ else if (outputFormat === 'jpeg') {
16127
+ dataUrl = await domToJpeg(element, fallbackOptions);
16128
+ }
16129
+ else {
16130
+ dataUrl = await domToPng(element, fallbackOptions);
16131
+ }
16132
+ // 验证截图结果
16133
+ if (!dataUrl || dataUrl.length < 100) {
16134
+ throw new Error('生成的截图数据无效或过短');
16135
+ }
16136
+ if (!this.options.silentMode) {
16137
+ console.log(`📸 ✅ modern-screenshot 截图成功(普通模式,${outputFormat.toUpperCase()} 格式)`);
16138
+ }
16139
+ return dataUrl;
16139
16140
  }
16140
- return dataUrl;
16141
16141
  }
16142
16142
  catch (error) {
16143
16143
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -16249,94 +16249,6 @@ class ScreenshotManager {
16249
16249
  threshold: 0.01
16250
16250
  });
16251
16251
  }
16252
- /**
16253
- * 初始化 IndexedDB(持久化缓存)
16254
- */
16255
- async initIndexedDB() {
16256
- return new Promise((resolve, reject) => {
16257
- const request = indexedDB.open('screenshot-cache', 1);
16258
- request.onerror = () => reject(request.error);
16259
- request.onsuccess = () => {
16260
- this.indexedDBCache = request.result;
16261
- this.indexedDBReady = true;
16262
- // 初始化后立即清理过期和超大小的缓存
16263
- this.cleanIndexedDBCache().catch(() => {
16264
- // 清理失败不影响功能
16265
- });
16266
- resolve();
16267
- };
16268
- request.onupgradeneeded = (event) => {
16269
- const db = event.target.result;
16270
- if (!db.objectStoreNames.contains('images')) {
16271
- const store = db.createObjectStore('images', { keyPath: 'url' });
16272
- // 创建索引用于按时间排序
16273
- store.createIndex('timestamp', 'timestamp', { unique: false });
16274
- }
16275
- };
16276
- });
16277
- }
16278
- /**
16279
- * 从 IndexedDB 获取缓存
16280
- */
16281
- async getIndexedDBCache(url) {
16282
- if (!this.indexedDBReady || !this.indexedDBCache) {
16283
- return null;
16284
- }
16285
- try {
16286
- const transaction = this.indexedDBCache.transaction(['images'], 'readonly');
16287
- const store = transaction.objectStore('images');
16288
- const request = store.get(url);
16289
- return new Promise((resolve) => {
16290
- request.onsuccess = () => {
16291
- const result = request.result;
16292
- if (result) {
16293
- const now = Date.now();
16294
- const age = now - result.timestamp;
16295
- // 检查是否超过最大缓存时间
16296
- if (age > this.options.maxCacheAge) {
16297
- // 缓存过期,删除
16298
- this.deleteIndexedDBCache(url);
16299
- resolve(null);
16300
- return;
16301
- }
16302
- // 返回缓存数据(即使超过 imageCacheTTL,只要未超过 maxCacheAge 仍可使用)
16303
- resolve(result.dataUrl);
16304
- }
16305
- else {
16306
- resolve(null);
16307
- }
16308
- };
16309
- request.onerror = () => resolve(null);
16310
- });
16311
- }
16312
- catch {
16313
- return null;
16314
- }
16315
- }
16316
- /**
16317
- * 设置 IndexedDB 缓存(带大小和时间控制)
16318
- */
16319
- async setIndexedDBCache(url, dataUrl) {
16320
- if (!this.indexedDBReady || !this.indexedDBCache) {
16321
- return;
16322
- }
16323
- try {
16324
- // 计算当前缓存大小
16325
- const currentSize = await this.getIndexedDBCacheSize();
16326
- const newItemSize = this.estimateDataUrlSize(dataUrl);
16327
- const maxSizeBytes = (this.options.maxCacheSize || 50) * 1024 * 1024; // 转换为字节
16328
- // 如果添加新项后超过限制,清理最旧的数据
16329
- if (currentSize + newItemSize > maxSizeBytes) {
16330
- await this.cleanIndexedDBCacheBySize(maxSizeBytes - newItemSize);
16331
- }
16332
- const transaction = this.indexedDBCache.transaction(['images'], 'readwrite');
16333
- const store = transaction.objectStore('images');
16334
- store.put({ url, dataUrl, timestamp: Date.now() });
16335
- }
16336
- catch {
16337
- // IndexedDB 写入失败,忽略
16338
- }
16339
- }
16340
16252
  /**
16341
16253
  * 估算 data URL 的大小(字节)
16342
16254
  */
@@ -16347,156 +16259,32 @@ class ScreenshotManager {
16347
16259
  return Math.ceil(base64Data.length * 0.75) + 30;
16348
16260
  }
16349
16261
  /**
16350
- * 获取 IndexedDB 当前缓存大小(字节)
16262
+ * 获取 IndexedDB 当前缓存大小(已移除,不再使用)
16263
+ * @deprecated IndexedDB 已移除,不再使用
16351
16264
  */
16352
16265
  async getIndexedDBCacheSize() {
16353
- if (!this.indexedDBReady || !this.indexedDBCache) {
16354
- return 0;
16355
- }
16356
- try {
16357
- const transaction = this.indexedDBCache.transaction(['images'], 'readonly');
16358
- const store = transaction.objectStore('images');
16359
- const request = store.getAll();
16360
- return new Promise((resolve) => {
16361
- request.onsuccess = () => {
16362
- const items = request.result || [];
16363
- let totalSize = 0;
16364
- items.forEach((item) => {
16365
- totalSize += this.estimateDataUrlSize(item.dataUrl);
16366
- });
16367
- resolve(totalSize);
16368
- };
16369
- request.onerror = () => resolve(0);
16370
- });
16371
- }
16372
- catch {
16373
- return 0;
16374
- }
16266
+ return 0;
16375
16267
  }
16376
16268
  /**
16377
- * 清理 IndexedDB 缓存(按时间和大小)
16269
+ * 清理 IndexedDB 缓存(已移除,不再使用)
16270
+ * @deprecated IndexedDB 已移除,不再使用
16378
16271
  */
16379
16272
  async cleanIndexedDBCache() {
16380
- if (!this.indexedDBReady || !this.indexedDBCache) {
16381
- return;
16382
- }
16383
- try {
16384
- const transaction = this.indexedDBCache.transaction(['images'], 'readwrite');
16385
- const store = transaction.objectStore('images');
16386
- const index = store.index('timestamp');
16387
- const request = index.getAll();
16388
- return new Promise((resolve) => {
16389
- request.onsuccess = () => {
16390
- const items = request.result || [];
16391
- const now = Date.now();
16392
- const expiredUrls = [];
16393
- let currentSize = 0;
16394
- const maxSizeBytes = (this.options.maxCacheSize || 50) * 1024 * 1024;
16395
- // 按时间排序(最旧的在前)
16396
- items.sort((a, b) => a.timestamp - b.timestamp);
16397
- // 清理过期数据
16398
- items.forEach((item) => {
16399
- const age = now - item.timestamp;
16400
- if (age > this.options.maxCacheAge) {
16401
- expiredUrls.push(item.url);
16402
- }
16403
- else {
16404
- currentSize += this.estimateDataUrlSize(item.dataUrl);
16405
- }
16406
- });
16407
- // 如果仍然超过大小限制,删除最旧的数据
16408
- const urlsToDelete = [...expiredUrls];
16409
- if (currentSize > maxSizeBytes) {
16410
- for (const item of items) {
16411
- if (expiredUrls.includes(item.url))
16412
- continue;
16413
- currentSize -= this.estimateDataUrlSize(item.dataUrl);
16414
- urlsToDelete.push(item.url);
16415
- if (currentSize <= maxSizeBytes) {
16416
- break;
16417
- }
16418
- }
16419
- }
16420
- // 删除过期和超大小的数据
16421
- urlsToDelete.forEach((url) => {
16422
- store.delete(url);
16423
- });
16424
- if (urlsToDelete.length > 0 && !this.options.silentMode) {
16425
- console.log(`📸 IndexedDB 清理了 ${urlsToDelete.length} 个缓存项(过期或超大小)`);
16426
- }
16427
- resolve();
16428
- };
16429
- request.onerror = () => resolve();
16430
- });
16431
- }
16432
- catch {
16433
- // 清理失败,忽略
16434
- }
16273
+ // IndexedDB 已移除,不再使用
16435
16274
  }
16436
16275
  /**
16437
- * 按大小清理 IndexedDB 缓存
16276
+ * 按大小清理 IndexedDB 缓存(已移除,不再使用)
16277
+ * @deprecated IndexedDB 已移除,不再使用
16438
16278
  */
16439
- async cleanIndexedDBCacheBySize(targetSize) {
16440
- if (!this.indexedDBReady || !this.indexedDBCache) {
16441
- return;
16442
- }
16443
- try {
16444
- const transaction = this.indexedDBCache.transaction(['images'], 'readwrite');
16445
- const store = transaction.objectStore('images');
16446
- const index = store.index('timestamp');
16447
- const request = index.getAll();
16448
- return new Promise((resolve) => {
16449
- request.onsuccess = () => {
16450
- const items = request.result || [];
16451
- // 按时间排序(最旧的在前)
16452
- items.sort((a, b) => a.timestamp - b.timestamp);
16453
- let currentSize = 0;
16454
- const urlsToDelete = [];
16455
- // 计算当前大小
16456
- items.forEach((item) => {
16457
- currentSize += this.estimateDataUrlSize(item.dataUrl);
16458
- });
16459
- // 如果超过目标大小,删除最旧的数据
16460
- if (currentSize > targetSize) {
16461
- for (const item of items) {
16462
- if (currentSize <= targetSize) {
16463
- break;
16464
- }
16465
- currentSize -= this.estimateDataUrlSize(item.dataUrl);
16466
- urlsToDelete.push(item.url);
16467
- }
16468
- }
16469
- // 删除数据
16470
- urlsToDelete.forEach((url) => {
16471
- store.delete(url);
16472
- });
16473
- if (urlsToDelete.length > 0 && !this.options.silentMode) {
16474
- console.log(`📸 IndexedDB 清理了 ${urlsToDelete.length} 个缓存项(超过大小限制)`);
16475
- }
16476
- resolve();
16477
- };
16478
- request.onerror = () => resolve();
16479
- });
16480
- }
16481
- catch {
16482
- // 清理失败,忽略
16483
- }
16279
+ async cleanIndexedDBCacheBySize(_targetSize) {
16280
+ // IndexedDB 已移除,不再使用
16484
16281
  }
16485
16282
  /**
16486
- * 删除 IndexedDB 缓存
16283
+ * 删除 IndexedDB 缓存(已移除,不再使用)
16284
+ * @deprecated IndexedDB 已移除,不再使用
16487
16285
  */
16488
- async deleteIndexedDBCache(url) {
16489
- if (!this.indexedDBReady || !this.indexedDBCache) {
16490
- return;
16491
- }
16492
- try {
16493
- const transaction = this.indexedDBCache.transaction(['images'], 'readwrite');
16494
- const store = transaction.objectStore('images');
16495
- store.delete(url);
16496
- }
16497
- catch {
16498
- // 忽略错误
16499
- }
16286
+ async deleteIndexedDBCache(_url) {
16287
+ // IndexedDB 已移除,不再使用
16500
16288
  }
16501
16289
  /**
16502
16290
  * 检查元素是否在可视区域内(优化:使用 Intersection Observer 或 getBoundingClientRect)
@@ -16711,10 +16499,6 @@ class ScreenshotManager {
16711
16499
  const dataUrl = await this.blobToDataUrl(blob);
16712
16500
  // 缓存结果(带时间戳,10分钟有效)
16713
16501
  this.setCachedImage(url, dataUrl);
16714
- // 如果启用 IndexedDB,也保存到 IndexedDB
16715
- if (this.options.useIndexedDB) {
16716
- await this.setIndexedDBCache(url, dataUrl);
16717
- }
16718
16502
  return dataUrl;
16719
16503
  }
16720
16504
  // 如果下载失败,返回原 URL,让 modern-screenshot 自己处理
@@ -17744,12 +17528,7 @@ class ScreenshotManager {
17744
17528
  this.intersectionObserver = null;
17745
17529
  this.visibleElementsCache.clear();
17746
17530
  }
17747
- // 关闭 IndexedDB
17748
- if (this.indexedDBCache) {
17749
- this.indexedDBCache.close();
17750
- this.indexedDBCache = null;
17751
- this.indexedDBReady = false;
17752
- }
17531
+ // IndexedDB 已移除,不再使用
17753
17532
  // 清理图片代理缓存
17754
17533
  this.imageProxyCache.clear();
17755
17534
  // 清理截图历史记录(释放大量内存)
@@ -17838,12 +17617,6 @@ class ScreenshotManager {
17838
17617
  // 每2分钟清理一次过期缓存(从5分钟改为2分钟,更频繁)
17839
17618
  setInterval(() => {
17840
17619
  this.cleanExpiredCache();
17841
- // 如果启用 IndexedDB,也清理 IndexedDB 缓存
17842
- if (this.options.useIndexedDB) {
17843
- this.cleanIndexedDBCache().catch(() => {
17844
- // 清理失败,忽略
17845
- });
17846
- }
17847
17620
  if (!this.options.silentMode) {
17848
17621
  const memoryCacheSize = this.imageProxyCache.size;
17849
17622
  const memoryCacheSizeMB = Array.from(this.imageProxyCache.values())