HSNotification
TypeA notification created by hs.notify.new().
Call .send() to deliver it to macOS Notification Center. You can hold a reference
to the object and call .withdraw() later to remove it.
Example:
const n = hs.notify.new({
title: "Build finished",
body: "Your project compiled successfully.",
actions: [{ identifier: "OPEN", title: "Open" }],
callback: (r) => { if (r.actionIdentifier === "OPEN") openProject() }
})
n.send()
Properties
identifier
string
The unique identifier assigned to this notification.
Use it to correlate with system notification APIs if needed.
Methods
send() -> HSNotification
Deliver this notification immediately to Notification Center.
Declaration
send() -> HSNotification
Returns
HSNotification
self, for method chaining
Example
hs.notify.new({ title: "Hi", body: "There" }).send()
withdraw() -> None
Remove this notification from Notification Center (if delivered) or cancel it (if pending).
Declaration
withdraw() -> None
Returns
None
Example
const n = hs.notify.new({ title: "Hi", body: "There" }).send()
n.withdraw()