lion/packages/ui/components/overlays/src/singleton.js
ByoungYong Kim 6e0ed97423
Feat/lazy loaded singleton (#2570)
* feat(singleton-manager): lazifyInstation functionality

* Update getLocalizeManager to register itself lazily

Co-authored by: Thijs Louisse <Thijs.Louisse@ing.com>

---------

Co-authored-by: Byoungyoung Kim <Byoungyoung.Kim@ing.com>
2025-09-17 09:12:06 +02:00

16 lines
512 B
JavaScript

import { singletonManager, lazifyInstantiation } from 'singleton-manager';
import { OverlaysManager } from './OverlaysManager.js';
/**
* @returns {OverlaysManager}
*/
function getOverlaysManager() {
if (!singletonManager.has('@lion/ui::overlays::0.x')) {
const overlaysManager = new OverlaysManager();
singletonManager.set('@lion/ui::overlays::0.x', overlaysManager);
}
return singletonManager.get('@lion/ui::overlays::0.x');
}
export const overlays = lazifyInstantiation(getOverlaysManager);