mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 00:10:52 +00:00
Show toast when offline
This commit is contained in:
parent
62e51f2157
commit
7710058e98
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
# 0.4.7
|
||||
|
||||
- [x] Show toast when offline
|
||||
|
||||
# 0.4.6
|
||||
|
||||
- [x] Improve search results loading indicator
|
||||
|
@ -21,6 +21,16 @@
|
||||
export const showWarning = (message, opts = {}) => showToast({message, theme: "warning", ...opts})
|
||||
|
||||
export const showPublishInfo = (pub, opts = {}) => showToast({pub, type: "publish", ...opts})
|
||||
|
||||
window.addEventListener('online', () => {
|
||||
if (toast.get()?.id === 'offline') {
|
||||
toast.set(null)
|
||||
}
|
||||
})
|
||||
|
||||
window.addEventListener('offline', () => {
|
||||
showInfo("You are currently offline.", {id: 'offline', timeout: null})
|
||||
})
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
Loading…
Reference in New Issue
Block a user