nfldb_m2
This is an old revision of the document!
get web first then cache
self.addEventListener('fetch', (event) => {
event.respondWith(
fetch(event.request)
.then((networkResponse) => {
// Clone the response before caching (it can only be read once)
return caches.open('dynamic-cache').then((cache) => {
cache.put(event.request, networkResponse.clone());
return networkResponse;
});
})
.catch(() => {
// Fallback to cache if the network request fails (offline)
return caches.match(event.request);
})
);
});
schedule sql
$sql = "SELECT tblGamesBrief.ID as briefID, tblGamesFull.ID as homeID, tblGamesFull.xTeam as homeTeam, tblGamesFull.xDate as xDate, tblGamesFull.xWeek as xWeek, tblGamesFull_1.ID as awayID, tblGamesFull_1.xTeam as awayTeam, (case when (Month(tblGamesFull.xDate)> 5) then Year(tblGamesFull.xDate) else Year(tblGamesFull.xDate) - 1 end) as xYear FROM (tblGamesBrief INNER JOIN tblGamesFull ON tblGamesBrief.xHomeTeam = tblGamesFull.ID) INNER JOIN tblGamesFull AS tblGamesFull_1 ON tblGamesBrief.xVisitingTeam = tblGamesFull_1.ID Where (case when (Month(tblGamesFull.xDate)> 5) then Year(tblGamesFull.xDate) else Year(tblGamesFull.xDate) - 1 end)=$getYear order by tblGamesFull.xDate";
network first for start_url
if (event.request.mode === 'navigate') {
event.respondWith(
// 1. Try the network first
fetch(event.request)
.then((response) => {
// Clone the response so we can put one in cache and return the other
const responseToCache = response.clone();
caches.open(CACHE_NAME).then((cache) => {
cache.put(event.request, responseToCache);
});
return response;
})
.catch(() => {
// 2. Fallback to cache if network fails (offline)
return caches.match(event.request);
})
);
}
nfldb_m2.1780275659.txt.gz · Last modified: 2026/06/01 01:00 by admin