UNPKG

2.38 kBTypeScriptView Raw
1// Type definitions for node-notifier 8.0
2// Project: https://github.com/mikaelbr/node-notifier
3// Definitions by: Qubo <https://github.com/tkQubo>
4// Lorenzo Rapetti <https://github.com/loryman>
5// Piotr Błażejewicz <https://github.com/peterblazejewicz>
6// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
8/// <reference types="node" />
9
10import NotificationCenter = require('./notifiers/notificationcenter');
11import NotifySend = require('./notifiers/notifysend');
12import WindowsToaster = require('./notifiers/toaster');
13import WindowsBalloon = require('./notifiers/balloon');
14import Growl = require('./notifiers/growl');
15
16declare namespace nodeNotifier {
17 interface NodeNotifier extends NodeJS.EventEmitter {
18 notify(notification?: NotificationCenter.Notification, callback?: NotificationCallback): NotificationCenter;
19 notify(notification?: WindowsToaster.Notification, callback?: NotificationCallback): WindowsToaster;
20 notify(notification?: WindowsBalloon.Notification, callback?: NotificationCallback): WindowsBalloon;
21 notify(notification?: NotifySend.Notification, callback?: NotificationCallback): NotifySend;
22 notify(notification?: Growl.Notification, callback?: NotificationCallback): Growl;
23 notify(notification?: Notification | string, callback?: NotificationCallback): NodeNotifier;
24 NotificationCenter: typeof NotificationCenter;
25 NotifySend: typeof NotifySend;
26 WindowsToaster: typeof WindowsToaster;
27 WindowsBalloon: typeof WindowsBalloon;
28 Growl: typeof Growl;
29 }
30
31 interface Notification {
32 title?: string;
33 message?: string;
34 /** Absolute path (not balloons) */
35 icon?: string;
36 /** Wait with callback until user action is taken on notification */
37 wait?: boolean;
38 }
39
40 interface NotificationMetadata {
41 activationType?: string;
42 activationAt?: string;
43 deliveredAt?: string;
44 activationValue?: string;
45 activationValueIndex?: string;
46 }
47
48 interface NotificationCallback {
49 (err: Error | null, response: string, metadata?: NotificationMetadata): void;
50 }
51
52 interface Option {
53 withFallback?: boolean;
54 customPath?: string;
55 }
56}
57
58declare var nodeNotifier: nodeNotifier.NodeNotifier;
59
60export = nodeNotifier;