Last active
June 2, 2022 10:23
-
-
Save jphungcode/c97ac0303a687ac1f846f16ac14f53f3 to your computer and use it in GitHub Desktop.
electron notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main.js | |
import {systemPreferences} from "electron" | |
app.whenReady().then(async () => { | |
systemPreferences.subscribeNotification( | |
"subscribeEvent", | |
(event, userInfo) => { | |
console.log(userInfo); | |
}, | |
); | |
// you would probably embed this in a ipcMain event call to hook up to UI | |
systemPreferences.postNotification( | |
"postEvent", | |
{ | |
// some data | |
foo: "bar" | |
}, | |
true, | |
); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment