-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efc7416
commit 7424369
Showing
4 changed files
with
33 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint-disable no-restricted-globals */ | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable consistent-return */ | ||
|
||
self.addEventListener('install', () => { | ||
self.skipWaiting(); | ||
}); | ||
|
||
// Handle notification clicks (using a service worker because android requires use of service workers for notifications) | ||
// Modified from https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/notificationclick_event | ||
self.addEventListener('notificationclick', (event) => { | ||
if (event.notification.tag === 'timer') { | ||
event.notification.close(); | ||
|
||
// This looks to see if the current is already open and focuses if it is | ||
event.waitUntil(clients.matchAll({ type: 'window' }).then((clientList) => { | ||
for (let i = 0; i < clientList.length; i++) { | ||
const client = clientList[i]; | ||
if (new URL(client.url).pathname === '/tools' && 'focus' in client) { | ||
client.postMessage('stop-timer-done-audio'); | ||
return client.focus(); | ||
} | ||
} | ||
if (clients.openWindow) return clients.openWindow('/tools'); | ||
})); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<template> | ||
<!-- <div // FIX | ||
<!-- <div // FIX? | ||
v-hammer:swipe.horizontal="onSwipe" | ||
v-focus | ||
tabindex="-1" | ||
|
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