feat: implement TooltipManager for managing tooltip lifecycle (#24236)

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
AADI GUPTA
2025-08-22 08:12:48 +05:30
committed by GitHub
parent c5614d04d2
commit 6b01b0b165
2 changed files with 25 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
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()