2
我发现了如何使用Firefox的插件生成器显示桌面通知。像下面的代码一样,但是如何显示HTML自定义通知,Google Chrome扩展可以显示自定义的Html通知。这对Firefox来说可能如何?带Addon Builder的Html桌面通知Firefox
这是一个典型的例子。单击消息时,会将字符串记录到控制台。
var notifications = require("notifications");
notifications.notify({
title: "Jabberwocky",
text: "'Twas brillig, and the slithy toves",
data: "did gyre and gimble in the wabe",
onClick: function (data) {
console.log(data);
// console.log(this.data) would produce the same result.
}
});
此人显示存储在附加组件的数据目录中的图标。 (有关详细信息,请参阅自模块文档。)
var notifications = require("notifications");
var self = require("self");
var myIconURL = self.data.url("myIcon.png");
notifications.notify({
text: "I have an icon!",
iconURL: myIconURL
});