-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added reminders, now when we schedule the reminder, it will notify us and if an url was saved, it will auto reload a tab with the saved url, since firefox doesn't let loading urls from javascript, it gives an error
- Loading branch information
1 parent
e1d48a6
commit 704f293
Showing
3 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
browser.storage.sync.set({todos:[]}); | ||
browser.alarms.onAlarm.addListener(listen); | ||
|
||
function listen(alarm){ | ||
console.log(alarm); | ||
var prom = browser.storage.sync.get(null); | ||
prom.then((res) => { | ||
console.log(res.todos[parseInt(alarm.name)]); | ||
browser.notifications.create('notify', { | ||
"type": "basic", | ||
"iconUrl": 'icons/clock.jpg', | ||
"title": "Todo4U Notifier", | ||
"message": res.todos[parseInt(alarm.name)] | ||
}); | ||
browser.notifications.onClicked.addListener(function(notificationId) { | ||
console.log('Notification ' + notificationId + ' was clicked by the user'); | ||
if(res.todos[parseInt(alarm.name)]+3!=''){ | ||
browser.tabs.create({ | ||
url:res.todos[parseInt(alarm.name)]+3 | ||
}); | ||
} | ||
}); | ||
}); | ||
} |
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
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