From af91b0052a3799d1feced712a7b13a7ab66a7463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E4=BA=9A=E6=98=95?= <1549469775@qq.com> Date: Fri, 15 Aug 2025 17:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/command/PlatForm/command.ts | 6 +- src/main/command/Tabs/command.ts | 66 +++++++ src/main/controller/BasicService.ts | 1 + src/main/controller/TabsService.ts | 1 + src/main/controller/_ioc.ts | 12 +- src/main/modules/_ioc.ts | 6 +- src/renderer/components.d.ts | 2 + src/renderer/src/commands/PlatForm.ts | 61 ++++++ src/renderer/src/commands/Setting.ts | 23 +++ src/renderer/src/commands/Updater.ts | 13 ++ src/renderer/src/components/Card/Card.vue | 10 + .../CodeEditor/PlaceholderContentWidget.ts | 4 + .../src/components/CodeEditor/code-editor-plus.vue | 105 +++++++++++ src/renderer/src/components/CodeEditor/hook.ts | 210 +++++++++++++++++++-- src/renderer/src/components/CodeEditor/monaco.ts | 5 +- .../src/composables/Api/Platform/_/index.ts | 58 ------ .../src/composables/Api/Platform/useApiPlatForm.ts | 2 +- .../src/composables/Api/Setting/_/index.ts | 23 --- .../src/composables/Api/Setting/useApiSetting.ts | 2 +- .../src/composables/Api/Updater/_/index.ts | 13 -- src/renderer/src/pages/_ui/Browser.vue | 4 +- src/renderer/src/pages/index/index.vue | 14 +- src/renderer/src/pages/setting/index.vue | 37 ++-- 23 files changed, 527 insertions(+), 151 deletions(-) create mode 100644 src/main/command/Tabs/command.ts create mode 100644 src/renderer/src/commands/PlatForm.ts create mode 100644 src/renderer/src/commands/Setting.ts create mode 100644 src/renderer/src/commands/Updater.ts create mode 100644 src/renderer/src/components/Card/Card.vue create mode 100644 src/renderer/src/components/CodeEditor/code-editor-plus.vue delete mode 100644 src/renderer/src/composables/Api/Platform/_/index.ts delete mode 100644 src/renderer/src/composables/Api/Setting/_/index.ts delete mode 100644 src/renderer/src/composables/Api/Updater/_/index.ts diff --git a/src/main/command/PlatForm/command.ts b/src/main/command/PlatForm/command.ts index 0555b9b..24af395 100644 --- a/src/main/command/PlatForm/command.ts +++ b/src/main/command/PlatForm/command.ts @@ -1,4 +1,4 @@ -import { app, dialog, nativeTheme, TitleBarOverlayOptions } from "electron" +import { app, dialog, nativeTheme, shell, TitleBarOverlayOptions } from "electron" import { inject } from "inversify" import errorHandler from "logger/main-error" import WindowManager from "main/modules/window-manager" @@ -88,6 +88,10 @@ export default class PlatFormCommand { app.exit() } + openDir(url: string, opts: Parameters[1]) { + return shell.openExternal(url, opts) + } + reload() { const focusedWindow = this._WindowManager.getFocusWindow() // 重载之后, 刷新并关闭所有的次要窗体 diff --git a/src/main/command/Tabs/command.ts b/src/main/command/Tabs/command.ts new file mode 100644 index 0000000..4b786ac --- /dev/null +++ b/src/main/command/Tabs/command.ts @@ -0,0 +1,66 @@ +import { inject } from "inversify" +import Tabs from "main/modules/tabs" +import WindowManager from "main/modules/window-manager" +import { broadcast } from "utils/main" + +class TabsCommand { + constructor( + @inject(Tabs) private _Tabs: Tabs, + @inject(WindowManager) private _WindowManager: WindowManager, + ) { + this.listenerTabActive = this.listenerTabActive.bind(this) + this._Tabs.events.on("update", this.listenerTabActive) + } + + bindElement(rect) { + this._Tabs.updateRect(rect) + } + + reload() { + this._WindowManager.getMainWindow()?.reload() + } + + sync() { + this.listenerTabActive() + if (!this.getAllTabs().length) { + this.add("about:blank") + } + } + + listenerTabActive() { + broadcast("TabsCommand.update", this.getAllTabs()) + } + + add(url) { + this._Tabs.add(url, true, this._WindowManager.getMainWindow()!) + } + + nagivate(index: number, url: string) { + this._Tabs.navigate(+index, url) + } + + setActive(index) { + this._Tabs.changeActive(index) + } + + closeTab(e) { + this._Tabs.remove(e.body.active) + } + + closeAll() { + this._Tabs.closeAll() + } + + getAllTabs() { + return this._Tabs._tabs.map(v => ({ + url: v.url, + showUrl: v.showUrl, + title: v.title, + favicons: v.favicons, + isActive: v.isActive, + })) + } +} + +export { TabsCommand } +export default TabsCommand diff --git a/src/main/controller/BasicService.ts b/src/main/controller/BasicService.ts index f25e582..b2a1408 100644 --- a/src/main/controller/BasicService.ts +++ b/src/main/controller/BasicService.ts @@ -5,6 +5,7 @@ import WindowManager from "main/modules/window-manager" @injectable() class BasicService extends BaseContainer { + static name = "Basic" constructor( @inject(WindowManager) private _WindowManager: WindowManager, // @inject(Tabs) private _Tabs: Tabs, diff --git a/src/main/controller/TabsService.ts b/src/main/controller/TabsService.ts index 3d8538d..f581ab7 100644 --- a/src/main/controller/TabsService.ts +++ b/src/main/controller/TabsService.ts @@ -5,6 +5,7 @@ import WindowManager from "main/modules/window-manager" @injectable() class TabsService extends BaseContainer { + static name = "Tabs" constructor( @inject(Tabs) private _Tabs: Tabs, @inject(WindowManager) private _WindowManager: WindowManager, diff --git a/src/main/controller/_ioc.ts b/src/main/controller/_ioc.ts index c5fb51a..66ab01d 100644 --- a/src/main/controller/_ioc.ts +++ b/src/main/controller/_ioc.ts @@ -1,4 +1,7 @@ import { Container, ContainerModule } from "inversify" +import _logger from "logger/main" + +const logger = _logger.createNamespace("service") /** * 自动加载所有服务模块 @@ -10,9 +13,12 @@ const modules = new ContainerModule(bind => { Object.values(serviceModules).forEach(module => { // 由于 module 类型为 unknown,需要进行类型断言 const ServiceClass = (module as { default: any }).default - if (ServiceClass && ServiceClass.name.endsWith("Service")) { - const serviceName = ServiceClass.name - bind(serviceName).to(ServiceClass).inSingletonScope() + if (ServiceClass) { + const className = ServiceClass.name.replace("Service", "") + logger.debug(`绑定服务类: ${className}Service`) + bind(className + "Service") + .to(ServiceClass) + .inSingletonScope() } }) }) diff --git a/src/main/modules/_ioc.ts b/src/main/modules/_ioc.ts index 7f63082..29edba1 100644 --- a/src/main/modules/_ioc.ts +++ b/src/main/modules/_ioc.ts @@ -1,7 +1,7 @@ import { Container, ContainerModule } from "inversify" import { Api } from "./api" import { WindowManager } from "./window-manager" -// import { Tabs } from "./tabs" +import { Tabs } from "./tabs" import Commands from "./commands" import Zephyr from "./zephyr" @@ -10,7 +10,7 @@ const modules = new ContainerModule(bind => { bind(Api).toSelf().inSingletonScope() bind(WindowManager).toSelf().inSingletonScope() bind(Commands).toSelf().inSingletonScope() - // bind(Tabs).toSelf().inSingletonScope() + bind(Tabs).toSelf().inSingletonScope() }) async function destroyAllModules(ioc: Container) { @@ -18,7 +18,7 @@ async function destroyAllModules(ioc: Container) { ioc.get(WindowManager).destroy(), ioc.get(Commands).destroy(), ioc.get(Zephyr).destroy(), - // ioc.get(Tabs).destroy(), + ioc.get(Tabs).destroy(), ioc.get(Api).destroy(), ]) ioc.unloadAsync(modules) diff --git a/src/renderer/components.d.ts b/src/renderer/components.d.ts index a584a5a..5445c71 100644 --- a/src/renderer/components.d.ts +++ b/src/renderer/components.d.ts @@ -9,7 +9,9 @@ export {} declare module 'vue' { export interface GlobalComponents { AdjustLine: typeof import('./src/components/AdjustLine.vue')['default'] + Card: typeof import('./src/components/Card/Card.vue')['default'] CodeEditor: typeof import('./src/components/CodeEditor/code-editor.vue')['default'] + CodeEditorPlus: typeof import('./src/components/CodeEditor/code-editor-plus.vue')['default'] 'IconBxs:error': typeof import('~icons/bxs/error')['default'] 'IconGrommetIcons:update': typeof import('~icons/grommet-icons/update')['default'] 'IconIx:reset': typeof import('~icons/ix/reset')['default'] diff --git a/src/renderer/src/commands/PlatForm.ts b/src/renderer/src/commands/PlatForm.ts new file mode 100644 index 0000000..359eb24 --- /dev/null +++ b/src/renderer/src/commands/PlatForm.ts @@ -0,0 +1,61 @@ +import { ApiFactory } from "base/api/abstract" +import { BaseSingleton } from "base" +import { LogLevel } from "packages/logger/common" + +class PlatForm extends BaseSingleton { + constructor() { + super() + } + + private get api() { + return ApiFactory.getApiClient() + } + + async logSetLevel(level: LogLevel) { + return this.api.call("PlatFormCommand.logSetLevel", level) + } + + async logGetLevel() { + return this.api.call("PlatFormCommand.logGetLevel") + } + + async showAbout() { + // return this.api.call("BasicService.showAbout") + return this.api.call("PlatFormCommand.showAbout") + } + + async showSrd() { + // return this.api.call("BasicService.showAbout") + return this.api.call("PlatFormCommand.showSrd") + } + + async getSrdCookie() { + // return this.api.call("BasicService.showAbout") + return this.api.call("PlatFormCommand.getSrdCookie") + } + + async crash() { + return this.api.call("PlatFormCommand.crash") + } + + async isFullScreen() { + return this.api.call("PlatFormCommand.isFullscreen") + } + + async toggleFullScreen() { + return this.api.call("PlatFormCommand.fullscreen") + } + + async reload() { + return this.api.call("PlatFormCommand.reload") + } + + async toggleDevTools() { + return this.api.call("PlatFormCommand.toggleDevTools") + } + async openDir(dir: string) { + return this.api.call("PlatFormCommand.openDir", dir) + } +} + +export { PlatForm } diff --git a/src/renderer/src/commands/Setting.ts b/src/renderer/src/commands/Setting.ts new file mode 100644 index 0000000..1e7690f --- /dev/null +++ b/src/renderer/src/commands/Setting.ts @@ -0,0 +1,23 @@ +import { ApiFactory } from "base/api/abstract" +import { BaseSingleton } from "base" +import { IConfig } from "config" + +class Setting extends BaseSingleton { + constructor() { + super() + } + + private get api() { + return ApiFactory.getApiClient() + } + + sync() { + return this.api.callSync("SettingCommand.sync") + } + + save(config: IConfig) { + return this.api.call("SettingCommand.save", config) + } +} + +export { Setting } diff --git a/src/renderer/src/commands/Updater.ts b/src/renderer/src/commands/Updater.ts new file mode 100644 index 0000000..7838a68 --- /dev/null +++ b/src/renderer/src/commands/Updater.ts @@ -0,0 +1,13 @@ +import { BaseEvent } from "base/api/abstract" + +class Updater extends BaseEvent { + constructor() { + super() + } + + test() { + this.api + } +} + +export { Updater } diff --git a/src/renderer/src/components/Card/Card.vue b/src/renderer/src/components/Card/Card.vue new file mode 100644 index 0000000..c85e8be --- /dev/null +++ b/src/renderer/src/components/Card/Card.vue @@ -0,0 +1,10 @@ + diff --git a/src/renderer/src/components/CodeEditor/PlaceholderContentWidget.ts b/src/renderer/src/components/CodeEditor/PlaceholderContentWidget.ts index 98942b7..dc29d86 100644 --- a/src/renderer/src/components/CodeEditor/PlaceholderContentWidget.ts +++ b/src/renderer/src/components/CodeEditor/PlaceholderContentWidget.ts @@ -38,6 +38,10 @@ export class PlaceholderContentWidget implements monaco.editor.IContentWidget { this.domNode.style.pointerEvents = "none" this.domNode.textContent = this.placeholder this.domNode.style.fontStyle = "italic" + const a = document.createElement("a") + a.href = "https://baiud.com" + a.textContent = "百度" + this.domNode.appendChild(a) this.editor.applyFontInfo(this.domNode) } diff --git a/src/renderer/src/components/CodeEditor/code-editor-plus.vue b/src/renderer/src/components/CodeEditor/code-editor-plus.vue new file mode 100644 index 0000000..7de95c4 --- /dev/null +++ b/src/renderer/src/components/CodeEditor/code-editor-plus.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/renderer/src/components/CodeEditor/hook.ts b/src/renderer/src/components/CodeEditor/hook.ts index f97a36f..5c81104 100644 --- a/src/renderer/src/components/CodeEditor/hook.ts +++ b/src/renderer/src/components/CodeEditor/hook.ts @@ -1,33 +1,209 @@ import { monaco } from "./monaco" +import { PlaceholderContentWidget } from "./PlaceholderContentWidget" +import { judgeFile } from "./utils" +import type { Ref } from "vue" -const defaultOptions: monaco.editor.IStandaloneEditorConstructionOptions = { - fontSize: 14, - readOnly: false, - theme: "vs-light", - fontFamily: "Cascadia Mono, Consolas, 'Courier New', monospace", - lineHeight: 22, - scrollBeyondLastLine: false, - automaticLayout: true, - minimap: { - enabled: false, +function useResizeObserver(el: HTMLDivElement, callback: ResizeObserverCallback) { + const isSupported = window && "ResizeObserver" in window + let observer: ResizeObserver | undefined + const cleanup = () => { + if (observer) { + observer.disconnect() + observer = undefined + } + } + const stopWatch = watch( + () => el, + el => { + cleanup() + if (isSupported && window && el) { + observer = new ResizeObserver(callback) + observer!.observe(el, {}) + } + }, + { immediate: true }, + ) + const stop = () => { + cleanup() + stopWatch() + } + function tryOnScopeDispose(fn: () => void) { + if (getCurrentScope()) { + onScopeDispose(fn) + return true + } + return false + } + tryOnScopeDispose(() => { + stop() + }) +} + +export interface IOptions { + placeholder: string + filename: string + content: string + editorOptions: monaco.editor.IEditorOptions & monaco.editor.IGlobalEditorOptions + modelOptions: monaco.editor.ITextModelUpdateOptions + onCursorChange?: (e: monaco.editor.ICursorPositionChangedEvent) => void + onDidChangeContent?: (str: string) => void +} + +const defaultOptions: IOptions = { + placeholder: "请输入文本", + filename: "temp", + content: "", + editorOptions: { + fontSize: 14, + readOnly: false, + theme: "vs-light", + fontFamily: "Cascadia Mono, Consolas, 'Courier New', monospace", + scrollBeyondLastLine: false, + lineHeight: 22, + automaticLayout: true, + minimap: { + enabled: false, + }, }, + modelOptions: {}, } -function getOptions(opt = {}) { - return { - ...defaultOptions, - ...opt, +const assign = (curOpt, opt, parenyKey: string[] = [], config = { arrayExtend: "concat" }) => { + for (const key in opt) { + if (opt[key] !== undefined) { + if (typeof opt[key] === "function" && curOpt[key] !== undefined && typeof curOpt[key] !== "function") { + opt[key] = opt[key](curOpt[key]) + } + if (typeof opt[key] === "object" && !Array.isArray(opt[key]) && !Array.isArray(curOpt[key])) { + parenyKey.push(key) + assign(curOpt[key], opt[key], parenyKey, config) + } else if (typeof opt[key] === "object" && Array.isArray(opt[key]) && Array.isArray(curOpt[key])) { + if (config.arrayExtend === "concat") { + curOpt[key] = curOpt[key].concat(opt[key]) + } else { + curOpt[key] = opt[key] + } + } else if (curOpt[key] !== undefined && typeof curOpt[key] !== typeof opt[key]) { + throw new Error(`Type of ${parenyKey.join(",") + "." + key} is not match`) + } else { + curOpt[key] = opt[key] + } + } } + return curOpt } -export function useMonacoEditor(editor: HTMLDivElement) { +function getOptions(opt = {}, config = { arrayExtend: "concat" }): IOptions { + const curOptions = structuredClone(defaultOptions) + assign(curOptions, opt, [], config) + return curOptions +} + +export function useMonacoEditor(editorElement: Ref, opts: Partial) { + let curOption = getOptions(opts) as IOptions let editor: monaco.editor.IStandaloneCodeEditor | null = null let placeholderWidget: PlaceholderContentWidget | null = null + const updateOption = (opts: Partial) => { + if (!editor) return + curOption = assign(curOption, opts) + if (Object.hasOwn(opts, "placeholder")) { + if (placeholderWidget) { + placeholderWidget.dispose() + placeholderWidget = null + } + if (opts.placeholder) { + placeholderWidget = new PlaceholderContentWidget(opts.placeholder, editor) + } + } + if (Object.hasOwn(opts, "modelOptions") && opts.modelOptions) { + const model = editor.getModel() + model?.updateOptions(opts.modelOptions) + } + if (Object.hasOwn(opts, "editorOptions") && opts.editorOptions) { + editor.updateOptions(opts.editorOptions) + } + if (Object.hasOwn(opts, "filename")) { + updateModel(curOption.filename, curOption.content) + } + if (Object.hasOwn(opts, "content")) { + console.log("无法通过updateOption修改content") + } + } + + let isInnerChange = "waitting" // waitting, out, in + const setValue = (content: string) => { + if (isInnerChange === "waitting") { + isInnerChange = "out" + } + if (editor && isInnerChange === "out") { + editor.setValue(content) + } else { + isInnerChange = "waitting" + } + } + function updateModel(name: string, content: string) { + if (editor) { + const oldModel = editor.getModel() //获取旧模型 + const file = judgeFile(name) + // 这样定义的话model无法清除 + // monaco.editor.createModel("const a = 111","typescript", monaco.Uri.parse('file://root/file3.ts')) + const model: monaco.editor.ITextModel = monaco.editor.createModel(content ?? "", file?.language ?? "txt") + model.updateOptions(curOption.modelOptions) + model.onDidChangeContent(() => { + if (model) { + if (isInnerChange === "out") { + isInnerChange = "waitting" + return + } + isInnerChange = "in" + const code = model.getValue() + curOption.onDidChangeContent?.(code) + } + }) + if (oldModel) { + oldModel.dispose() + } + editor.setModel(model) + } + } + + tryOnMounted(() => { + if (editorElement.value && !editor) { + editor = monaco.editor.create(editorElement.value, curOption.editorOptions) as monaco.editor.IStandaloneCodeEditor + editor.onDidChangeCursorPosition(e => { + curOption.onCursorChange?.(e) + }) + if (!curOption.content) { + placeholderWidget = new PlaceholderContentWidget(curOption.placeholder, editor) + } else { + if (isInnerChange === "waitting") { + isInnerChange = "out" + } + } + updateModel(curOption.filename, curOption.content) + useResizeObserver(editorElement.value, () => { + editor!.layout() + }) + } + }) + + tryOnUnmounted(() => { + if (editor) { + const oldModel = editor.getModel() + if (oldModel) { + oldModel.dispose() + } + editor.dispose() + editor = null + } + }) return { + setValue, scrollTop() { - - } + editor?.setScrollTop(0) + }, + updateOption, } } diff --git a/src/renderer/src/components/CodeEditor/monaco.ts b/src/renderer/src/components/CodeEditor/monaco.ts index 7a3b3e9..3a07f9f 100644 --- a/src/renderer/src/components/CodeEditor/monaco.ts +++ b/src/renderer/src/components/CodeEditor/monaco.ts @@ -1,7 +1,7 @@ // import 'monaco-editor/esm/vs/editor/editor.all.js'; // import 'monaco-editor/esm/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.js'; -import * as monaco from "monaco-editor/esm/vs/editor/editor.api" + // import 'monaco-editor/esm/vs/basic-languages/monaco.contribution.js'; // import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution.js'; @@ -13,4 +13,7 @@ import * as monaco from "monaco-editor/esm/vs/editor/editor.api" // 导入全部特性 // import * as monaco from "monaco-editor" +import * as monaco from "monaco-editor/esm/vs/editor/editor.api" +import "monaco-editor/esm/vs/basic-languages/monaco.contribution.js" + export { monaco } diff --git a/src/renderer/src/composables/Api/Platform/_/index.ts b/src/renderer/src/composables/Api/Platform/_/index.ts deleted file mode 100644 index 7e3930e..0000000 --- a/src/renderer/src/composables/Api/Platform/_/index.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ApiFactory } from "base/api/abstract" -import { BaseSingleton } from "base" -import { LogLevel } from "packages/logger/common" - -class PlatForm extends BaseSingleton { - constructor() { - super() - } - - private get api() { - return ApiFactory.getApiClient() - } - - async logSetLevel(level: LogLevel) { - return this.api.call("PlatFormCommand.logSetLevel", level) - } - - async logGetLevel() { - return this.api.call("PlatFormCommand.logGetLevel") - } - - async showAbout() { - // return this.api.call("BasicService.showAbout") - return this.api.call("PlatFormCommand.showAbout") - } - - async showSrd() { - // return this.api.call("BasicService.showAbout") - return this.api.call("PlatFormCommand.showSrd") - } - - async getSrdCookie() { - // return this.api.call("BasicService.showAbout") - return this.api.call("PlatFormCommand.getSrdCookie") - } - - async crash() { - return this.api.call("PlatFormCommand.crash") - } - - async isFullScreen() { - return this.api.call("PlatFormCommand.isFullscreen") - } - - async toggleFullScreen() { - return this.api.call("PlatFormCommand.fullscreen") - } - - async reload() { - return this.api.call("PlatFormCommand.reload") - } - - async toggleDevTools() { - return this.api.call("PlatFormCommand.toggleDevTools") - } -} - -export { PlatForm } diff --git a/src/renderer/src/composables/Api/Platform/useApiPlatForm.ts b/src/renderer/src/composables/Api/Platform/useApiPlatForm.ts index 87de469..33f1bbd 100644 --- a/src/renderer/src/composables/Api/Platform/useApiPlatForm.ts +++ b/src/renderer/src/composables/Api/Platform/useApiPlatForm.ts @@ -1,5 +1,5 @@ import { LogLevel } from "logger/common" -import { PlatForm } from "./_" +import { PlatForm } from "@/commands/PlatForm" export function useApiPlatForm() { const plat = PlatForm.getInstance() diff --git a/src/renderer/src/composables/Api/Setting/_/index.ts b/src/renderer/src/composables/Api/Setting/_/index.ts deleted file mode 100644 index 1e7690f..0000000 --- a/src/renderer/src/composables/Api/Setting/_/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ApiFactory } from "base/api/abstract" -import { BaseSingleton } from "base" -import { IConfig } from "config" - -class Setting extends BaseSingleton { - constructor() { - super() - } - - private get api() { - return ApiFactory.getApiClient() - } - - sync() { - return this.api.callSync("SettingCommand.sync") - } - - save(config: IConfig) { - return this.api.call("SettingCommand.save", config) - } -} - -export { Setting } diff --git a/src/renderer/src/composables/Api/Setting/useApiSetting.ts b/src/renderer/src/composables/Api/Setting/useApiSetting.ts index d982f77..93deca2 100644 --- a/src/renderer/src/composables/Api/Setting/useApiSetting.ts +++ b/src/renderer/src/composables/Api/Setting/useApiSetting.ts @@ -1,5 +1,5 @@ import { defineStore } from "pinia" -import { Setting } from "./_" +import { Setting } from "@/commands/Setting" import type { IConfig } from "config" import type { EventMaps, SettingCommand } from "command/Setting/type" diff --git a/src/renderer/src/composables/Api/Updater/_/index.ts b/src/renderer/src/composables/Api/Updater/_/index.ts deleted file mode 100644 index 7838a68..0000000 --- a/src/renderer/src/composables/Api/Updater/_/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BaseEvent } from "base/api/abstract" - -class Updater extends BaseEvent { - constructor() { - super() - } - - test() { - this.api - } -} - -export { Updater } diff --git a/src/renderer/src/pages/_ui/Browser.vue b/src/renderer/src/pages/_ui/Browser.vue index e34435e..8e87567 100644 --- a/src/renderer/src/pages/_ui/Browser.vue +++ b/src/renderer/src/pages/_ui/Browser.vue @@ -51,9 +51,9 @@ } } if (import.meta.hot) { - api.off("main:TabsCommand.update", listener) + api.off("TabsCommand.update", listener) } - api.on("main:TabsCommand.update", listener) + api.on("TabsCommand.update", listener) onMounted(() => { api.call("TabsCommand.sync") }) diff --git a/src/renderer/src/pages/index/index.vue b/src/renderer/src/pages/index/index.vue index 004c5a8..3d8846a 100644 --- a/src/renderer/src/pages/index/index.vue +++ b/src/renderer/src/pages/index/index.vue @@ -10,19 +10,13 @@