forked from felixrieseberg/electron-windows-notifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.js
32 lines (27 loc) · 988 Bytes
/
template.js
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
// Create shortcut, just to be sure
require('./shortcut')
// Sample
const appId = 'electron-windows-notifications'
const Notification = require('../src/notification')
const Template = require('../src/template')
let notificationSimple = new Notification({
appId: appId,
template: new Template({
templateText: '<text id="1">%s</text>'
}).getXML(),
strings: ['Hi!']
})
notificationSimple.on('activated', () => console.log('Actived!'))
notificationSimple.show()
let imagePath = (`file:///${path.join(__dirname, 'images', 'bp.png').replace(/\\/g, '/')}`)
let notificationImage = new Notification({
appId: appId,
template: new Template({
templateText: '<text id="1">%s</text>',
templateImage: '<image id="1" src="%s"/>',
templateActions: '<actions><action content="check" arguments="check" /></actions>'
}).getXML(),
strings: [imagePath, 'Hi!']
})
notificationImage.on('activated', () => console.log('Actived!'))
notificationImage.show()