PWA Timer in Background

I am trying to build a Pomodoro-style timer into my SvelteKit PWA, so that it can run in the background when the app is closed (or unfocussed) and send the user a push notification when it has finished. However, I am not quite sure how to achieve this, while also having it work offline. I have done a bit of reasearch and found that the Background Sync API would not work for this.

How would I go about making this work? Is it possible in a PWA? And if not, is there another way to try to implement this (preferably using one codebase)?