From ebec1d047ad599601574aa2b7f64b1a217a7ac57 Mon Sep 17 00:00:00 2001 From: Quentin Decaunes Date: Sun, 18 Aug 2019 12:36:44 +0200 Subject: [PATCH] refactor: Notification will now be displayed using system if available. --- js/methods.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/js/methods.js b/js/methods.js index 0920065..06fb977 100644 --- a/js/methods.js +++ b/js/methods.js @@ -228,12 +228,26 @@ function isWindows() { */ function notification(type, message) { appendLog(`notification(): ${type}\n${message}`); - UIkit.notification({ - message: (''+message).replace(/(?:\r\n|\r|\n)/g, '
'), - status: type, - pos: 'top-right', - timeout: 5000 + + if (window.last_notification) { + window.last_notification.close(); + window.last_notification = false; + } + window.last_notification = new Notification('Ryzen Controller', { + body: message, + requireInteraction: false, + silent: true, }); + + if (!window.last_notification) { + window.last_notification = false; + UIkit.notification({ + message: (''+message).replace(/(?:\r\n|\r|\n)/g, '
'), + status: type, + pos: 'top-right', + timeout: 5000, + }); + } } /**