我现在已经成功了,谢谢这里的所有人:)https://github.com/mikaelbr/node-notifier/issues/144#issuecomment-319324058
基于anthonyraymond
的评论,你需要有你的应用程序INSTALLED
在你的 Windows 机器上使用 appId。您可以配置appId
在你的package.json
像这样。
{
"name": "myapp",
"version": "1.0.0",
"description": "test",
"main": "main.js",
"build": {
"appId": "com.myapp.id"
}
}
The appId
不需要那个java/android
格式,我的应用程序只有一个appId
of elite-notifier
.
然后你就可以通过appId
当呼叫notify
通知者的功能。
notifier.notify(
{
appName: "com.myapp.id", <-- yes, the key here is appName :)
title: "Hello",
message: "Hello world!",
wait: true
},
function(err, response) {
// Response is response from notification
console.log("responded...");
}
);
安装后,即使在开发模式下也可以工作(通过跑步electron .
command)前提是您不会更改appId
安装后您的应用程序的版本,因为安装的应用程序和应用程序的开发版本会不匹配。