UNPKG

node-notifier

Version:

A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)

33 lines (32 loc) • 1.49 kB
import utils from "./lib/utils.js"; import Notifier$3 from "./notifiers/balloon.js"; import Notifier from "./notifiers/growl.js"; import Notifier$1 from "./notifiers/notificationcenter.js"; import Notifier$2 from "./notifiers/notifysend.js"; import Notifier$4 from "./notifiers/toaster.js"; import os from "node:os"; // src/index.ts function selectNotifier() { switch (utils.isWSL() ? "WSL" : os.type()) { case "Linux": return Notifier$2; case "Darwin": return Notifier$1; case "Windows_NT": return utils.isLessThanWin8() ? Notifier$3 : Notifier$4; case "WSL": return process.env.NODE_NOTIFIER_WSL_NOTIFIER === "linux" ? Notifier$2 : Notifier$4; default: return /BSD$/.test(os.type()) ? Notifier$2 : Notifier; } } /** The notifier class picked for the current platform. */ const Notification = selectNotifier(); /** A ready-to-use instance of the notifier for the current platform. */ const notifier = Object.assign(new Notification({ withFallback: true }), { Notification, NotifySend: Notifier$2, NotificationCenter: Notifier$1, WindowsToaster: Notifier$4, WindowsBalloon: Notifier$3, Growl: Notifier }); /** `notify` of the default instance, bound so it can be used on its own. */ const notify = notifier.notify; export { Notifier as Growl, Notification, Notifier$1 as NotificationCenter, Notifier$2 as NotifySend, Notifier$3 as WindowsBalloon, Notifier$4 as WindowsToaster, notifier as default, notifier as "module.exports", notify }; //# sourceMappingURL=index.js.map