mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
Implement lazy loading and infinite scroll features in core application
- Added lazy loading for images and initialized infinite scroll in the AppCore class to enhance performance across various pages. - Updated LoraPageManager and RecipeManager to utilize the new initializePageFeatures method for common UI features. - Enhanced infinite scroll functionality to dynamically load more content based on the page type, improving user experience. - Refactored recipes.html to trigger the import modal through the ModalManager for better modal handling.
This commit is contained in:
@@ -5,7 +5,8 @@ import { modalManager } from './managers/ModalManager.js';
|
||||
import { updateService } from './managers/UpdateService.js';
|
||||
import { HeaderManager } from './components/Header.js';
|
||||
import { SettingsManager } from './managers/SettingsManager.js';
|
||||
import { showToast, initTheme, initBackToTop, updatePanelPositions } from './utils/uiHelpers.js';
|
||||
import { showToast, initTheme, initBackToTop, updatePanelPositions, lazyLoadImages } from './utils/uiHelpers.js';
|
||||
import { initializeInfiniteScroll } from './utils/infiniteScroll.js';
|
||||
|
||||
// Core application class
|
||||
export class AppCore {
|
||||
@@ -55,10 +56,28 @@ export class AppCore {
|
||||
showToast(message, type = 'info') {
|
||||
showToast(message, type);
|
||||
}
|
||||
|
||||
// Initialize common UI features based on page type
|
||||
initializePageFeatures() {
|
||||
const pageType = this.getPageType();
|
||||
|
||||
// Initialize lazy loading for images on all pages
|
||||
lazyLoadImages();
|
||||
|
||||
// Initialize infinite scroll for pages that need it
|
||||
if (['loras', 'recipes', 'checkpoints'].includes(pageType)) {
|
||||
initializeInfiniteScroll(pageType);
|
||||
}
|
||||
|
||||
// Update panel positions
|
||||
updatePanelPositions();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// Create and export a singleton instance
|
||||
export const appCore = new AppCore();
|
||||
|
||||
// Export common utilities for global use
|
||||
export { showToast, modalManager, state };
|
||||
export { showToast, modalManager, state, lazyLoadImages, initializeInfiniteScroll };
|
||||
Reference in New Issue
Block a user