13 lines
259 B
TypeScript
13 lines
259 B
TypeScript
type WindowTarget = {
|
|
focus: () => void
|
|
location: {
|
|
assign: (href: string) => void
|
|
}
|
|
}
|
|
|
|
export const handleNotificationClick = (href?: string, target: WindowTarget = window) => {
|
|
target.focus()
|
|
if (!href) return
|
|
target.location.assign(href)
|
|
}
|