From de8724fd0a2a07284830a8f62ae9f43d7a48c60e Mon Sep 17 00:00:00 2001 From: Daniel <50356015+danny007in@users.noreply.github.com> Date: Sun, 29 Jan 2023 18:34:13 +0530 Subject: [PATCH] ts minor improve --- src/ts/card-widget.ts | 2 +- src/ts/treeview.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ts/card-widget.ts b/src/ts/card-widget.ts index 14b4fa40a..5eca1c17c 100644 --- a/src/ts/card-widget.ts +++ b/src/ts/card-widget.ts @@ -42,7 +42,7 @@ const Default = { minimizeIcon: 'fa-compress' } -interface Config { +type Config = { animationSpeed: number; collapseTrigger: string; removeTrigger: string; diff --git a/src/ts/treeview.ts b/src/ts/treeview.ts index afc4c42fb..36a62c3fa 100644 --- a/src/ts/treeview.ts +++ b/src/ts/treeview.ts @@ -35,7 +35,7 @@ const Default = { animationSpeed: 300 } -interface Config { +type Config = { animationSpeed: number; } @@ -58,7 +58,7 @@ class Treeview { } open(): void { - const event = new CustomEvent(EVENT_EXPANDED) + const event = new Event(EVENT_EXPANDED) if (this._navItem) { this._navItem.classList.add(CLASS_NAME_MENU_OPEN) @@ -72,7 +72,8 @@ class Treeview { } close(): void { - const event = new CustomEvent(EVENT_COLLAPSED) + const event = new Event(EVENT_COLLAPSED) + if (this._navItem) { this._navItem.classList.remove(CLASS_NAME_MENU_IS_OPEN) this._navItem.classList.remove(CLASS_NAME_MENU_OPEN)