Skip to content

Commit

Permalink
ask for notification permisson onclick
Browse files Browse the repository at this point in the history
  • Loading branch information
cankurttekin committed Sep 29, 2024
1 parent dd9a1fa commit ead501c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ var logInner = document.getElementById("log").innerHTML


// Request permission for notifications
document.addEventListener('DOMContentLoaded', function() {
function notificationPermission() {
if (Notification.permission !== "granted") {
Notification.requestPermission();
}
});
}

function sendNotification(title, body) {
if (Notification.permission === "granted") {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1 class="site-title">TCDD-CLI Web</h1>
<option value="business">Business</option>
</select>
</div>
<button type="button" id="start-search-button" onclick="startSearch()">Search for Trips</button>
<button type="button" id="start-search-button" onclick="startSearch();notificationPermission();">Search for Trips</button>
<div id="statusContainer">
<div id="log"></div>
<div>
Expand Down

0 comments on commit ead501c

Please sign in to comment.