From 9f8f1fb69e2b7295a56a06c9997645671b030d2c Mon Sep 17 00:00:00 2001 From: frostime Date: Sat, 3 Jun 2023 16:34:30 +0800 Subject: [PATCH] `onload` done --- src/index.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7c129b5..ee7db52 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,13 +19,13 @@ const STORAGE_NAME = "menu-config"; const TAB_TYPE = "custom_tab"; const DOCK_TYPE = "dock_tab"; -export default class SamplePlugin extends Plugin { +export default class PluginSample extends Plugin { - private customTab: () => any; + private customTab: () => IModel; private isMobile: boolean; async onload() { - this.data[STORAGE_NAME] = { readonlyText: "Readonly" }; + this.data[STORAGE_NAME] = {readonlyText: "Readonly"}; const frontEnd = getFrontend(); this.isMobile = frontEnd === "mobile" || frontEnd === "browser-mobile"; @@ -60,7 +60,7 @@ export default class SamplePlugin extends Plugin { statusIconTemp.content.firstElementChild.addEventListener("click", () => { confirm("⚠️", this.i18n.confirmRemove.replace("${name}", this.name), () => { this.removeData(STORAGE_NAME).then(() => { - this.data[STORAGE_NAME] = { readonlyText: "Readonly" }; + this.data[STORAGE_NAME] = {readonlyText: "Readonly"}; showMessage(`[${this.name}]: ${this.i18n.removedData}`); }); }); @@ -69,9 +69,9 @@ export default class SamplePlugin extends Plugin { element: statusIconTemp.content.firstElementChild as HTMLElement, }); - let div = document.createElement("div"); + let tabDiv = document.createElement("div"); new HelloExample({ - target: div, + target: tabDiv, props: { name: this.i18n.name, i18n: this.i18n.hello @@ -80,7 +80,7 @@ export default class SamplePlugin extends Plugin { this.customTab = this.addTab({ type: TAB_TYPE, init() { - this.element.appendChild(div); + this.element.appendChild(tabDiv); console.log(this.element); }, destroy() { @@ -99,8 +99,8 @@ export default class SamplePlugin extends Plugin { this.addDock({ config: { position: "LeftBottom", - size: { width: 200, height: 0 }, - icon: "iconEmoji", + size: {width: 200, height: 0}, + icon: "iconSaving", title: "Custom Dock", }, data: {