feat: implement TooltipManager for managing tooltip lifecycle (#24236)
Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
16
web/app/components/base/tooltip/TooltipManager.ts
Normal file
16
web/app/components/base/tooltip/TooltipManager.ts
Normal 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()
|
Reference in New Issue
Block a user