API Docs

A 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.
send() -> HSNotification
HSNotification
self, for method chaining
hs.notify.new({ title: "Hi", body: "There" }).send()

withdraw() -> None

Remove this notification from Notification Center (if delivered) or cancel it (if pending).
withdraw() -> None
None
const n = hs.notify.new({ title: "Hi", body: "There" }).send()
n.withdraw()