dify/web/app/components/base/tooltip/TooltipManager.ts
AADI GUPTA 6b01b0b165
feat: implement TooltipManager for managing tooltip lifecycle (#24236)
Co-authored-by: crazywoola <427733928@qq.com>
2025-08-22 10:42:48 +08:00

17 lines
358 B
TypeScript

class TooltipManager {
private activeCloser: (() => void) | null = null
register(closeFn: () => void) {
if (this.activeCloser)
this.activeCloser()
this.activeCloser = closeFn
}
clear(closeFn: () => void) {
if (this.activeCloser === closeFn)
this.activeCloser = null
}
}
export const tooltipManager = new TooltipManager()