Code: Select all
// Nofitication Function
function myNotification(channelName, title) {
var notification = browser.notifications.create("online_status",{
"type": "basic",
"iconUrl": browser.extension.getURL("icons/64.png"),
"title": title,
"message": "Click this message to visit the website!\nTell your friends about " + nickname + " ;-)",
"eventTime": 32400000
});
browser.notifications.onClicked.addListener(function() {
time = bigRotation; // increase check time
localStorage.TIME = bigRotation;
browser.tabs.create({"url": "http://www.url.com/" + channelName});
});
browser.notifications.onButtonClicked.addListener(function() {
time = bigRotation; // increase check time
localStorage.TIME = bigRotation;
});
}
//------------------------------------------------------------------------------
1. Problem: eventTime
The event time should keep the Notification alive for 9h.
I tested it with 1, 2, 5 minutes aswell. Wont work. It's close after ~10-15 sec...
2. Problem: onButtonClicked
I try to get the X (close) button clicked (right top corner of a Notification).
When a user close the Notification with the X-Symbol, it ads a 9h rotation time.
So that the Notification will not apear again in the next 9h.
The same for a click ON the Notification. If someone click the Notification a new browser tab is opened.
And the delay is set to 9h aswell.
I tried the onClosed() method. But this happens also when the Notification disapears without any user interaction (click).
So I can't use onClosed().
But onButtonClicked() seems only working with a custom button or something.
Here are the resources:
- Create: https://developer.mozilla.org/en-US/Add ... ons/create
- Event time: https://developer.mozilla.org/en-US/Add ... ionOptions
- onButtonClicked: https://developer.mozilla.org/en-US/Add ... tonClicked
- onClosed: https://developer.mozilla.org/en-US/Add ... s/onClosed
Thanks for your help! <3