arafatamim / waqt-web

View Islamic prayer times for your location

Home Page:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notifications support

arafatamim opened this issue · comments

Send a push notification 5 mins before, or at the time of, upcoming prayer.

I have been playing with the notification trigger API which is only supported in chrome behind a feature flag

async function scheduleNotification() {
  const registration = await navigator.serviceWorker.getRegistration();
  registration.showNotification('Salah Duhr', {
    body: 'Salah Duhr has arrived',
    showTrigger: new TimestampTrigger( + 10_000)  // notification will be triggered after 10 seconds

I haven't checked yet but it might be possible to use this with the periodic background sync API to schedule a batch of notifications every 7 days.

An alternative approach that doesn't require any bleeding edge API would be to notify users if waqt app hasn't been closed yet.

Haven't heard of that API before. Could be useful.

ezoic increase your site revenue