Skip to content

Commit 4700542

Browse files
committed
get notification permission when start app
1 parent 254ad2f commit 4700542

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

walletSrc/modules/init/preload.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,20 @@ window.viteWalletStorage = appLocalStorage;
88
window.viteWalletRequest = appHttp;
99
window.viteWalletI18n = appI18n;
1010
window.DESKTOP = true;
11-
window.ipcRenderer = ipcRenderer;
11+
window.ipcRenderer = ipcRenderer;
12+
13+
if (Notification.permission === "granted") {
14+
console.info('Notification is granted.');
15+
} else if (Notification.permission !== 'denied') {
16+
Notification.requestPermission(function (permission) {
17+
if (permission === "granted") {
18+
console.log('Got notification permission');
19+
}
20+
if (permission === 'default') {
21+
console.log('The permission request was dismissed.');
22+
}
23+
if (permission === 'denied') {
24+
console.log('Permission wasn\'t granted. Allow a retry.');
25+
}
26+
});
27+
}

0 commit comments

Comments
 (0)