mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-11-13 15:09:20 +01:00
feat: add UI toast notification for missing Firefox browser
This commit is contained in:
22
app/toastNotifier.js
Normal file
22
app/toastNotifier.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const {getMainWindow} = require("./windowManager");
|
||||
|
||||
/**
|
||||
* Sends a toast notification to the renderer UI when the main window is ready.
|
||||
*
|
||||
* @param {string} message
|
||||
* @param {"success"|"error"|"warning"|"info"} [type="info"]
|
||||
* @param {number} [duration=4000]
|
||||
* @returns {boolean} Whether the toast was sent.
|
||||
*/
|
||||
function sendToast(message, type = "info", duration = 4000) {
|
||||
const mainWindow = getMainWindow();
|
||||
|
||||
if (!mainWindow || mainWindow.isDestroyed() || mainWindow.webContents.isDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mainWindow.webContents.send("show-toast", {message, type, duration});
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = {sendToast};
|
||||
Reference in New Issue
Block a user