diff options
| author | Brendan Allan <[email protected]> | 2026-03-04 15:12:34 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-04 15:12:34 +0800 |
| commit | 5cf235fa6cf7b4c890c68f8ff68a96fcae992abf (patch) | |
| tree | 25fdfd8ce95ad048fb097822995dcf060e8d6d8b /packages/app/src/utils/notification-click.ts | |
| parent | e4f0825c56300286ec0aa82b1006e4006a17e1e1 (diff) | |
| download | opencode-5cf235fa6cf7b4c890c68f8ff68a96fcae992abf.tar.gz opencode-5cf235fa6cf7b4c890c68f8ff68a96fcae992abf.zip | |
desktop: add electron version (#15663)
Diffstat (limited to 'packages/app/src/utils/notification-click.ts')
| -rw-r--r-- | packages/app/src/utils/notification-click.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/app/src/utils/notification-click.ts b/packages/app/src/utils/notification-click.ts index 1234cd1d6..94086c595 100644 --- a/packages/app/src/utils/notification-click.ts +++ b/packages/app/src/utils/notification-click.ts @@ -1,12 +1,12 @@ -type WindowTarget = { - focus: () => void - location: { - assign: (href: string) => void - } +let nav: ((href: string) => void) | undefined + +export const setNavigate = (fn: (href: string) => void) => { + nav = fn } -export const handleNotificationClick = (href?: string, target: WindowTarget = window) => { - target.focus() +export const handleNotificationClick = (href?: string) => { + window.focus() if (!href) return - target.location.assign(href) + if (nav) nav(href) + else window.location.assign(href) } |
