1
0
mirror of https://github.com/comatory/fb2iCal synced 2025-06-05 22:09:25 +02:00

refactor: completely remove existing javascript and use Svelte app

exclusively for rendering
This commit is contained in:
Ondřej Synáček
2020-12-20 15:24:25 +01:00
parent 377a4bcd80
commit 8900474af7
15 changed files with 17 additions and 141 deletions

View File

@@ -0,0 +1,41 @@
class Logger {
constructor() {
this._remote = false
}
log({ message, level, service }) {
console.info(
`%c${level}\n%c${service}\n%c${message}`,
'color: white; background-color: blue; font-weight: 800',
'color: grey',
'color: black'
)
if (!this._remote) {
return
}
this._log({ message, level, service })
}
setRemoteLogging(value) {
this._remote = value
}
_log({ message, level, service }) {
return new Promise((resolve, reject) => {
fetch('/track', {
method: 'POST',
headers: {
'Accept': 'text/html, application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({ message, level, service, env: 'browser' })
})
.then(resolve)
.catch(reject)
})
}
}
export default new Logger()

View File

@@ -1,10 +1,6 @@
import { STORAGE_KEYS } from '../constants'
import { configStore, eventStore } from '../stores'
export const STORAGE_KEYS = {
CONFIG: 'fb-to-ical-config',
EVENTS: 'fb-to-ical-events',
}
class StorageListener {
constructor() {
this._storeSubscribers = new Set()