From 02ab43574433e9cc27b8db03269f2cf9e3bab65a Mon Sep 17 00:00:00 2001 From: friebetill Date: Thu, 2 Feb 2023 18:25:10 +0800 Subject: [PATCH] Improve slighty code --- src/action_line.ts | 1 - src/differences_view.ts | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/action_line.ts b/src/action_line.ts index bd2f8c5..3331a07 100644 --- a/src/action_line.ts +++ b/src/action_line.ts @@ -2,7 +2,6 @@ import { TFile } from "obsidian"; import { Difference } from "./data/difference"; import { replaceLine } from "./utils/string_utils"; -// typedef for a voidcallback type VoidCallback = () => void; export class ActionLine { diff --git a/src/differences_view.ts b/src/differences_view.ts index bbfec1b..59dffd4 100644 --- a/src/differences_view.ts +++ b/src/differences_view.ts @@ -39,7 +39,7 @@ export class DifferencesView extends ItemView { this.file1.path, this.file2.path, file1Content, - file2Content, + file2Content ) ); @@ -83,11 +83,13 @@ export class DifferencesView extends ItemView { container: HTMLDivElement, difference: Difference ) { + const triggerRebuild = () => this.onOpen(); + new ActionLine( difference, this.file1, this.file2, - this.triggerRebuild + triggerRebuild ).build(container); difference.lines.forEach((line) => { @@ -106,8 +108,4 @@ export class DifferencesView extends ItemView { } }); } - - private triggerRebuild() { - this.onOpen(); - } }