Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
loehnertz committed Jun 9, 2024
1 parent aeaf006 commit 4c62416
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 46 deletions.
81 changes: 41 additions & 40 deletions public/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
const CACHE_NAME = 'tea-timer-cache-v1';
const CACHE_NAME = 'tea-timer-cache-v1'
const URLS_TO_CACHE = [
'./',
'./site.webmanifest',
'./index.html',
'./image/icon/favicon.ico',
'./image/icon/favicon-16x16.png',
'./image/icon/favicon-32x32.png',
'./image/icon/android-chrome-144x144.png',
'./image/icon/apple-touch-icon.png',
'./audio/sonar_high.mp3',
'./audio/sonar_low.mp3',
'https://cdn.jsdelivr.net/npm/bulma@1/css/bulma.min.css'
];
'./',
'./site.webmanifest',
'./index.html',
'./image/icon/favicon.ico',
'./image/icon/favicon-16x16.png',
'./image/icon/favicon-32x32.png',
'./image/icon/android-chrome-144x144.png',
'./image/icon/apple-touch-icon.png',
'./audio/sonar_high.mp3',
'./audio/sonar_low.mp3',
'./assets',
'https://cdn.jsdelivr.net/npm/bulma@1/css/bulma.min.css',
]

self.addEventListener('install', event => {
event.waitUntil(
caches.open(CACHE_NAME)
.then(cache => {
return cache.addAll(URLS_TO_CACHE);
})
);
});
event.waitUntil(
caches.open(CACHE_NAME)
.then(cache => {
return cache.addAll(URLS_TO_CACHE)
}),
)
})

self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request)
.then(response => {
return response || fetch(event.request);
})
);
});
event.respondWith(
caches.match(event.request)
.then(response => {
return response || fetch(event.request)
}),
)
})

self.addEventListener('activate', event => {
const cacheWhitelist = [CACHE_NAME];
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (cacheWhitelist.indexOf(cacheName) === -1) {
return caches.delete(cacheName);
}
})
);
})
);
});
const cacheWhitelist = [CACHE_NAME]
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (cacheWhitelist.indexOf(cacheName) === -1) {
return caches.delete(cacheName)
}
}),
)
}),
)
})
7 changes: 4 additions & 3 deletions src/components/TimerAdjustment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:value="offsetTime"
class="input"
type="number"
@input="updateOffsetTime($event.target.value)"
@input="updateOffsetTime"
/>
</div>
</div>
Expand Down Expand Up @@ -70,8 +70,9 @@ export default defineComponent({
const newOffset = (this.incrementTime * percentage) / 100
this.$emit('updateOffsetTime', newOffset)
},
updateOffsetTime(value: number) {
this.$emit('updateOffsetTime', parseFloat(value))
updateOffsetTime(event: Event) {
const target = event.target as HTMLInputElement
this.$emit('updateOffsetTime', parseFloat(target.value))
},
},
})
Expand Down
6 changes: 3 additions & 3 deletions src/views/GongFuBrewView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,20 @@ export default defineComponent({
}
},
toggleStartStop() {
this.$refs.timerDisplay.toggleStartStop()
;(this.$refs.timerDisplay as InstanceType<typeof TimerDisplay>).toggleStartStop()
},
nextInfusion() {
this.initialTime += this.offsetTime
this.infusionCount++
this.offsetTime = 0
this.persistSettings()
this.$refs.timerDisplay.resetTimer()
;(this.$refs.timerDisplay as InstanceType<typeof TimerDisplay>).resetTimer()
},
previousInfusion() {
if (this.infusionCount > 1) {
this.infusionCount--
this.persistSettings()
this.$refs.timerDisplay.resetTimer()
;(this.$refs.timerDisplay as InstanceType<typeof TimerDisplay>).resetTimer()
}
},
finishInfusion() {
Expand Down

0 comments on commit 4c62416

Please sign in to comment.