MCPcopy Create free account
hub / github.com/anomalyco/opencode / notify

Function notify

packages/app/src/entry.tsx:57–79  ·  view source on GitHub ↗
(title, description, href)

Source from the content-addressed store, hash-verified

55const writeDefaultServerUrl = (url: string | null) => setStorage(DEFAULT_SERVER_URL_KEY, url)
56
57const notify: Platform["notify"] = async (title, description, href) => {
58 if (!("Notification" in window)) return
59
60 const permission =
61 Notification.permission === "default"
62 ? await Notification.requestPermission().catch(() => "denied")
63 : Notification.permission
64
65 if (permission !== "granted") return
66
67 const inView = document.visibilityState === "visible" && document.hasFocus()
68 if (inView) return
69
70 const notification = new Notification(title, {
71 body: description ?? "",
72 icon: "https://opencode.ai/favicon-96x96-v3.png",
73 })
74
75 notification.onclick = () => {
76 handleNotificationClick(href)
77 notification.close()
78 }
79}
80
81const openLink: Platform["openLink"] = (url) => {
82 window.open(url, "_blank")

Callers 1

ProjectIconFunction · 0.50

Calls 2

handleNotificationClickFunction · 0.90
closeMethod · 0.45

Tested by

no test coverage detected