arafatamim / waqt-web

View Islamic prayer times for your location

Home Page:https://waqt-web.netlify.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notifications support

arafatamim opened this issue · comments

Description
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(Date.now() + 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