From 6d9da163036ee9712a95cb9b6da84b18f69afbb8 Mon Sep 17 00:00:00 2001 From: Steven Stallion Date: Thu, 20 Mar 2025 22:02:45 -0500 Subject: [PATCH] Remove unnecessary sleep function (#9) --- .prettierignore | 2 +- CHANGELOG.md | 4 ++++ src/settings.ts | 3 +-- src/util.ts | 4 ---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.prettierignore b/.prettierignore index a8a0890..b36db63 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,6 @@ *.* +!*.css !*.json !*.mjs -!*.scss !*.ts package-lock.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae5b41..509b0cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Removed unnecessary sleep function + ## [1.1.0] - 2025-03-19 ### Changed diff --git a/src/settings.ts b/src/settings.ts index 77e8c72..8c1e12c 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -26,7 +26,6 @@ import { PluginSettingTab, Setting } from "obsidian"; import { CommandLineContext } from "./command"; import CommandLinePlugin from "./main"; -import * as util from "./util"; const RELOAD_DELAY = 500; @@ -62,7 +61,7 @@ export class CommandLineSettingsTab extends PluginSettingTab { .onChange(async (value) => { this.plugin.settings.highlight = value; await this.plugin.saveSettings(); - await util.sleep(RELOAD_DELAY).then(() => { + await sleep(RELOAD_DELAY).then(() => { location.reload(); }); }); diff --git a/src/util.ts b/src/util.ts index b24184c..97935a3 100644 --- a/src/util.ts +++ b/src/util.ts @@ -44,10 +44,6 @@ export function mapTail(array: T[], callbackFn: (thisArg: T) => T): T[] { }, [] as T[]); } -export function sleep(delay: number): Promise { - return new Promise((resolve) => setTimeout(resolve, delay)); -} - export function waitForGlobal(name: string, delay = 100): Promise { return new Promise((resolve) => { (function resolver() {