-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreload.js
More file actions
36 lines (34 loc) · 1.06 KB
/
Preload.js
File metadata and controls
36 lines (34 loc) · 1.06 KB
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
const {
contextBridge,
ipcRenderer,
ipcMain,
Notification,
} = require("electron");
const os = require("os");
const path = require("path");
const Toastify = require("toastify-js");
contextBridge.exposeInMainWorld("Api", {
homedir: () => os.homedir(),
join: (...args) => path.join(...args),
toastify: (options) => Toastify(options).showToast(),
// notify: (options) => {
// let noti = new Notification({
// title: "Thanks for using Modi!",
// subtitle: "Hope you enjoyed the service 🙂",
// body: `Your image has been stored at: ${value} `,
// silent: false,
// hasReply: true,
// timeoutType: "never",
// replyPlaceholder: "Drop a feedback...",
// sound: Api.join("C:/Users/Oluwaloju/Modi", "../Assets/notify.mp3"),
// urgency: "critical",
// }).show();
// return noti;
// },
});
contextBridge.exposeInMainWorld("ipc", {
send: (data) => ipcRenderer.send("sent-from-renderer", data),
on: (callback) => {
ipcRenderer.on("received-from-main", (_event, value) => callback(value));
},
});