Skip to content

Commit

Permalink
static routing demo
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaxru committed Dec 4, 2024
1 parent 1091e25 commit a1c17d4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
/>
<meta name="twitter:image" content="https://bpmtech.no/images/social.png" />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<meta http-equiv="origin-trial" content="Av/10xZqHkSWfsTRboWq/GFjUR3QdATIasNdNONV4euNas7aGhtOQ9eDm2zCq8EOD8HyIKUvi/2b8AbbP9KEDAAAAAB6eyJvcmlnaW4iOiJodHRwczovL2JwbXRlY2gubm86NDQzIiwiZmVhdHVyZSI6IlNlcnZpY2VXb3JrZXJTdGF0aWNSb3V0ZXJUaW1pbmdJbmZvIiwiZXhwaXJ5IjoxNzUzMTQyNDAwLCJpc1N1YmRvbWFpbiI6dHJ1ZX0=" />
</head>
<body>
<div id="root"></div>
Expand Down
6 changes: 3 additions & 3 deletions src/AdLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function AdLink(props) {

let ads = {
'search-dj-controllers': {
link: 'https://www.amazon.com/gp/search?ie=UTF8&tag=maxious-20&linkCode=ur2&linkId=8ca01d484b759858f609454d6dbc68b7&camp=1789&creative=9325&index=mi&keywords=dj%20controllers',
link: 'https://www.amazon.com/gp/search?ie=UTF8&tag=webapplication-20&linkCode=ur2&linkId=8ca01d484b759858f609454d6dbc68b7&camp=1789&creative=9325&index=mi&keywords=dj%20controllers',
texts: [
'🎧🎛 Get 💰Savings on 🔥Hot DJ Controllers!',
'🤑DJ Controllers on 🔥Sale Now! 🤩',
Expand All @@ -28,15 +28,15 @@ function AdLink(props) {
],
},
'item-sample-pack': {
link: 'https://www.amazon.com/Samples-Maschine-Ableton-Instruments-Production/dp/B09C2M5D82/ref=sr_1_1?crid=6TO3QGDAE9Z0&keywords=ableton+sound+pack&qid=1688655275&rnid=2941120011&s=musical-instruments&sprefix=ableton+sound+pack%252Caps%252C172&sr=1-1&_encoding=UTF8&tag=maxious-20&linkCode=ur2&linkId=5a48eda719a3ed9bc124e62c1dce4080&camp=1789&creative=9325',
link: 'https://www.amazon.com/Samples-Maschine-Ableton-Instruments-Production/dp/B09C2M5D82/ref=sr_1_1?crid=6TO3QGDAE9Z0&keywords=ableton+sound+pack&qid=1688655275&rnid=2941120011&s=musical-instruments&sprefix=ableton+sound+pack%252Caps%252C172&sr=1-1&_encoding=UTF8&tag=webapplication-20&linkCode=ur2&linkId=5a48eda719a3ed9bc124e62c1dce4080&camp=1789&creative=9325',
texts: [
'🎧🤩100Gb Sound Pack: 100K+ Samples for Ableton, MPK, Logic🔥',
'🎧🤩100Gb Sound Pack: 100K+ Samples | 808s, Synths, Loops, FX🔥',
'🎧🤩EDM Production USB: 100K+ Samples for Ableton, MPK, Logic🔥',
],
},
'item-music-prod': {
link: 'https://www.amazon.com/Music-Production-Beginners-2022-Songwriters-ebook/dp/B09SZJD7XN/ref=sr_1_7?keywords=edm+dj+music+production&qid=1688664662&rnid=2941120011&s=books&sr=1-7&_encoding=UTF8&tag=maxious-20&linkCode=ur2&linkId=4f3bc88283a657ecc139adc47e46c2bf&camp=1789&creative=9325',
link: 'https://www.amazon.com/Music-Production-Beginners-2022-Songwriters-ebook/dp/B09SZJD7XN/ref=sr_1_7?keywords=edm+dj+music+production&qid=1688664662&rnid=2941120011&s=books&sr=1-7&_encoding=UTF8&tag=webapplication-20&linkCode=ur2&linkId=4f3bc88283a657ecc139adc47e46c2bf&camp=1789&creative=9325',
texts: [
'🎧📖Music Production For Beginners 2022+ Edition🔥',
'🎧📖How to Produce Music: The Easy to Read Guide for Beginners🔥',
Expand Down
5 changes: 5 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ function App() {
console.error(err);
});
}


const [navTiming] = window.performance.getEntriesByType("navigation");
console.log(navTiming)

}, []);

return (
Expand Down
46 changes: 45 additions & 1 deletion src/sw/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,50 @@ clientsClaim();
// Setting custom cache names
setCacheNameDetails({ precache: 'wb6-precache', runtime: 'wb6-runtime' });

// STATIC ROUTING

self.addEventListener('install', async (event) => {

if (event.addRoutes) {
try {
event.addRoutes([
{
condition: {
urlPattern: { pathname: '/login' },
},
source: 'network',
},
{
condition: {
urlPattern: { pathname: '/about' },
},
source: 'fetch-event',
},
{
condition: {
urlPattern: { pathname: '/privacy.html' },
},
source: {
cacheName: 'wb6-precache',
},
},
{
condition: {
urlPattern: { pathname: '/favicon.ico' },
},
source: 'race-network-and-fetch-handler',
},
]);
console.log('[SW] Routes registered');
} catch (err) {
console.error(err);
}
} else {
console.error('[SW] No static routing support');
}

});

// PRECACHING

// Precache and serve resources from __WB_MANIFEST array
Expand Down Expand Up @@ -103,4 +147,4 @@ registerRoute(
'POST'
);

googleAnalytics.initialize();
googleAnalytics.initialize();

0 comments on commit a1c17d4

Please sign in to comment.