chore: small changes

This commit is contained in:
surunzi
2023-02-21 09:06:51 +08:00
parent e671cbadfc
commit 081bcc2cdb
3 changed files with 9 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
const BundleAnalyzerPlugin =
require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
exports = require('./webpack.prod')

View File

@@ -14,7 +14,6 @@ import isNull from 'licia/isNull'
import isArr from 'licia/isArr'
import extend from 'licia/extend'
import evalCss from '../lib/evalCss'
import emitter from '../lib/emitter'
import Settings from '../Settings/Settings'
import LunaConsole from 'luna-console'
import LunaModal from 'luna-modal'
@@ -29,10 +28,7 @@ export default class Console extends Tool {
Emitter.mixin(this)
this.name = name
this._scale = 1
this._selectedLog = null
this._registerListener()
}
init($el, container) {
super.init($el)
@@ -139,14 +135,6 @@ export default class Console extends Tool {
$el.addClass(c('js-input-hidden'))
}
}
_registerListener() {
this._scaleListener = (scale) => (this._scale = scale)
emitter.on(emitter.SCALE, this._scaleListener)
}
_unregisterListener() {
emitter.off(emitter.SCALE, this._scaleListener)
}
_appendTpl() {
const $el = this._$el

View File

@@ -15,6 +15,7 @@ import isStr from 'licia/isStr'
import startWith from 'licia/startWith'
import ready from 'licia/ready'
import evalCss from '../lib/evalCss'
import emitter from '../lib/emitter'
import { isDarkTheme } from '../lib/themes'
import LunaNotification from 'luna-notification'
import LunaModal from 'luna-modal'
@@ -233,6 +234,7 @@ export default class DevTools extends Emitter {
this._tab.destroy()
this._$el.remove()
window.removeEventListener('resize', this._checkSafeArea)
emitter.off(emitter.SCALE, this._resetTabHeight)
}
_checkSafeArea = () => {
const { $container } = this
@@ -288,6 +290,9 @@ export default class DevTools extends Emitter {
})
this._tab.on('select', (id) => this.showTool(id))
}
_resetTabHeight = (scale) => {
this._tab.setOption('height', 40 * scale)
}
_initNotification() {
this._notification = new LunaNotification(
this._$el.find(c('.notification')).get(0),
@@ -354,5 +359,7 @@ export default class DevTools extends Emitter {
$navBar.on('contextmenu', (e) => e.preventDefault())
this.$container.on('click', (e) => e.stopPropagation())
window.addEventListener('resize', this._checkSafeArea)
emitter.on(emitter.SCALE, this._resetTabHeight)
}
}