From e6cfa30ed444b6983de934b28b7dfe9f8c819501 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sat, 21 Dec 2019 11:51:12 -0500 Subject: [PATCH] [O] Optimize encapsulation --- src/logic/navigator.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/logic/navigator.ts b/src/logic/navigator.ts index 7b297c8..fcc5c6c 100644 --- a/src/logic/navigator.ts +++ b/src/logic/navigator.ts @@ -14,22 +14,14 @@ export default class Navigator /** * Update index * - * @param hash + * @param index Hash and title | Hash only * @param history Record in history or not (Default true) */ - updateIndexHash(hash: string, history?: boolean) + updateIndex(index: Index | string, history?: boolean) { - this.updateIndex({hash: hash}, history) - } + // Convert index format if it is hash only + if (typeof index == 'string') index = {hash: index}; - /** - * Update index - * - * @param index Hash and title - * @param history Record in history or not (Default true) - */ - updateIndex(index: Index, history?: boolean) - { // Call custom event if (this.updateCallback != null) this.updateCallback();