2013-04-06 53 views
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 
}); 

回答