display-notification

Display a notification (macOS)

MIT 6 个版本
安装
npm install display-notification
yarn add display-notification
pnpm add display-notification
bun add display-notification
README

display-notification

Display a notification (macOS 10.9+)

Install

$ npm install display-notification

Usage

import displayNotification from 'display-notification';

await displayNotification({
	title: 'Unicorns',
	subtitle: 'Rainbows',
	text: 'Cake',
	sound: 'Bottle'
});

API

displayNotification(options)

Returns a promise that resolves when the notification is shown.

options

Specify at least a title or text.

title

Type: string

Title of the notification.

subtitle

Type: string

Subtitle of the notification.

text

Type: string

Content of the notification.

sound

Type: string
Values: Basso Blow Bottle Frog Funk Glass Hero Morse Ping Pop Purr Sosumi Submarine Tink

Name of the sound located in ~/Library/Sounds or /System/Library/Sounds:

版本列表
3.0.0 2021-05-03
2.0.0 2016-05-01
1.0.2 2015-02-16
1.0.1 2014-08-18
1.0.0 2014-08-06
0.1.0 2014-05-16