-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e1b97d
commit cd8fe6c
Showing
4 changed files
with
111 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// /// <reference lib="WebWorker" /> | ||
// /// <reference types="vite/client" /> | ||
// | ||
// import initMutinyWallet, { MutinyWallet } from "@mutinywallet/mutiny-wasm"; | ||
// | ||
// // SERVICE WORKER SETUP STUFF | ||
// declare let self: ServiceWorkerGlobalScope | ||
// | ||
// const entries = self.__WB_MANIFEST | ||
// | ||
// if (import.meta.env.DEV) | ||
// entries.push({ url: '/', revision: Math.random().toString() }) | ||
// | ||
// // allow only fallback in dev: we don't want to cache anything | ||
// let allowlist: undefined | RegExp[] | ||
// if (import.meta.env.DEV) | ||
// allowlist = [/^\/$/] | ||
// | ||
// // deny api and server page calls | ||
// let denylist: undefined | RegExp[] | ||
// if (import.meta.env.PROD) { | ||
// denylist = [ | ||
// /^\/sw.js$/, | ||
// // exclude webmanifest: has its own cache | ||
// /^\/manifest-(.*).webmanifest$/, | ||
// ] | ||
// } | ||
// | ||
// | ||
// ACTUAL LOGIC | ||
console.log("hello from the service worker?") | ||
|
||
self.addEventListener('push', (event) => { | ||
console.log("push event", event) | ||
const data = event.data.json(); | ||
const options = { | ||
body: data.body, | ||
icon: data.icon, | ||
badge: data.badge | ||
}; | ||
event.waitUntil( | ||
self.registration.showNotification(data.title, options) | ||
); | ||
}); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters