Files
Comfyui-LayerForge/js/ImageCache.js
Dariusz L c3cc33c711 Refactor image utilities and cache to separate modules
Moved image data validation, conversion, mask application, and preparation functions from Canvas_view.js to a new ImageUtils.js module. Extracted the image cache logic into a new ImageCache.js class. Updated Canvas_view.js to use the new modules and refactored relevant imports and usage.
2025-06-25 07:05:44 +02:00

25 lines
520 B
JavaScript

export class ImageCache {
constructor() {
this.cache = new Map();
}
set(key, imageData) {
console.log("Caching image data for key:", key);
this.cache.set(key, imageData);
}
get(key) {
const data = this.cache.get(key);
console.log("Retrieved cached data for key:", key, !!data);
return data;
}
has(key) {
return this.cache.has(key);
}
clear() {
console.log("Clearing image cache");
this.cache.clear();
}
}