mirror of
https://github.com/appen-isen/site-interpromo-2024.git
synced 2026-03-18 21:40:39 +01:00
Add notification support for cellphone
This commit is contained in:
@@ -48,5 +48,11 @@ function newGoalAlert(match, goalTeam){
|
||||
</div>
|
||||
`
|
||||
alertsContainer.insertAdjacentHTML("beforeend", alert)
|
||||
//Send a notification to the client if the browser supports it
|
||||
if (Notification.permission === "granted") {
|
||||
let notification = new Notification(`${match.expand.team1.name} - ${match.expand.team2.name}`, {
|
||||
body: `${match.point1} - ${match.point2}`,
|
||||
});
|
||||
}
|
||||
setTimeout(deleteAlert, 5000, `${match.id}${match.point1}_${match.point2}`)
|
||||
}
|
||||
@@ -6,6 +6,11 @@ let matchList = await pb.collection('match').getFullList({
|
||||
expand: 'team1,team2,sport',
|
||||
});
|
||||
|
||||
//Ask for notifications permission
|
||||
if (Notification.permission !== "granted") {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
|
||||
const equipeList = await pb.collection('equipes').getFullList({});
|
||||
|
||||
const sportList = await pb.collection('sport').getFullList({});
|
||||
|
||||
Reference in New Issue
Block a user