mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
17 lines
310 B
JavaScript
17 lines
310 B
JavaScript
class Notifications {
|
|
constructor() {
|
|
Notification.requestPermission();
|
|
}
|
|
|
|
notifyTurn(player) {
|
|
if (!document.hasFocus()) {
|
|
new Notification("Chess", {
|
|
body: "Your opponent has moved.",
|
|
icon: `/images/king_${player}.svg`
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
export default Notifications;
|