-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtoaster-custom-path.js
More file actions
51 lines (41 loc) · 936 Bytes
/
toaster-custom-path.js
File metadata and controls
51 lines (41 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* eslint-disable no-console */
const path = require( 'path' );
/*
Target specific notification vendor
*/
const { WindowsToaster } = require( '../' );
/*
withFallback
Fallback to Growl or Balloons?
customPath
Relative/Absolute path if you want to use your fork of SnoreToast.exe
*/
const customPath = path.join( 'vendor', 'ntfyToast', 'ntfytoast.exe' );
const toasted = new WindowsToaster({
withFallback: false,
customPath
});
/*
Push notifications
*/
toasted.notify(
{
message: 'Hello!',
icon: path.join( __dirname, 'example_1.png' ),
sound: true
},
( err, data ) =>
{
// Will also wait until notification is closed.
console.log( 'Waited' );
console.log( JSON.stringify({ err, data }) );
}
);
toasted.on( 'timeout', () =>
{
console.log( 'Timed out!' );
});
toasted.on( 'click', () =>
{
console.log( 'Clicked!' );
});