feat(settings): use luna setting

This commit is contained in:
redhoodsu
2023-01-18 18:40:29 +08:00
parent 69dd37a6d2
commit 5390fd0f26
10 changed files with 142 additions and 441 deletions

View File

@@ -11,12 +11,14 @@ import $ from 'licia/$'
import toNum from 'licia/toNum'
import isDarkMode from 'licia/isDarkMode'
import extend from 'licia/extend'
import isStr from 'licia/isStr'
import startWith from 'licia/startWith'
import evalCss from '../lib/evalCss'
import { isDarkTheme } from '../lib/themes'
import LunaNotification from 'luna-notification'
import LunaModal from 'luna-modal'
import LunaTab from 'luna-tab'
import { classPrefix as c, drag, eventClient } from '../lib/util'
import { classPrefix as c, drag, eventClient, safeStorage } from '../lib/util'
export default class DevTools extends Emitter {
constructor($container, { defaults = {} } = {}) {
@@ -195,6 +197,23 @@ export default class DevTools extends Emitter {
max: 100,
step: 1,
})
.button('Restore defaults and reload', function () {
const store = safeStorage('local')
const data = JSON.parse(JSON.stringify(store))
console.log(data)
each(data, (val, key) => {
if (!isStr(val)) {
return
}
if (startWith(key, 'eruda')) {
store.removeItem(key)
}
})
window.location.reload()
})
.separator()
}
notify(content, options) {