From 081bcc2cdbefa54f37cf7fb1bf068aafcfce66f9 Mon Sep 17 00:00:00 2001 From: surunzi Date: Tue, 21 Feb 2023 09:06:51 +0800 Subject: [PATCH] chore: small changes --- build/webpack.analyser.js | 4 ++-- src/Console/Console.js | 12 ------------ src/DevTools/DevTools.js | 7 +++++++ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/build/webpack.analyser.js b/build/webpack.analyser.js index 6317724..6b3879c 100644 --- a/build/webpack.analyser.js +++ b/build/webpack.analyser.js @@ -1,5 +1,5 @@ -const BundleAnalyzerPlugin = - require('webpack-bundle-analyzer').BundleAnalyzerPlugin +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') + .BundleAnalyzerPlugin exports = require('./webpack.prod') diff --git a/src/Console/Console.js b/src/Console/Console.js index ff04267..5672330 100644 --- a/src/Console/Console.js +++ b/src/Console/Console.js @@ -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 diff --git a/src/DevTools/DevTools.js b/src/DevTools/DevTools.js index 68d6ff9..937e98e 100644 --- a/src/DevTools/DevTools.js +++ b/src/DevTools/DevTools.js @@ -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) } }