Refactor scripts

This commit is contained in:
2019-11-18 11:04:13 +09:00
parent 7e25ee6faf
commit 1ddcd4d570
33 changed files with 670 additions and 749 deletions

@ -2,24 +2,24 @@ import AnimeNotifier from "../AnimeNotifier"
// Enable notifications
export async function enableNotifications(arn: AnimeNotifier, _: HTMLElement) {
if(!arn.user || !arn.user.dataset.id) {
if(!arn.user) {
return
}
arn.statusMessage.showInfo("Enabling instant notifications...")
await arn.pushManager.subscribe(arn.user.dataset.id)
await arn.pushManager.subscribe(arn.user.id)
arn.updatePushUI()
arn.statusMessage.showInfo("Enabled instant notifications for this device.")
}
// Disable notifications
export async function disableNotifications(arn: AnimeNotifier, _: HTMLElement) {
if(!arn.user || !arn.user.dataset.id) {
if(!arn.user) {
return
}
arn.statusMessage.showInfo("Disabling instant notifications...")
await arn.pushManager.unsubscribe(arn.user.dataset.id)
await arn.pushManager.unsubscribe(arn.user.id)
arn.updatePushUI()
arn.statusMessage.showInfo("Disabled instant notifications for this device.")
}