From 93eabd96abea77bc91fded2f01fd2993ff30bb46 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Mon, 3 Jun 2024 12:20:02 +0200 Subject: [PATCH] refactor(web): use `substring` instead of `slice` This addresses code review comments which recommended to use `substring` as this makes it more consistent with the rest of our code base. --- web/src/app/webview/src/debug-main.ts | 2 +- web/src/app/webview/src/release-main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/app/webview/src/debug-main.ts b/web/src/app/webview/src/debug-main.ts index 7e4d026204..02a47101a6 100644 --- a/web/src/app/webview/src/debug-main.ts +++ b/web/src/app/webview/src/debug-main.ts @@ -10,6 +10,6 @@ import { SourcemappedWorker } from '@keymanapp/lexical-model-layer/web' */ const scripts = document.getElementsByTagName('script'); const ss = scripts[scripts.length-1].src; -const sPath = ss.slice(0,ss.lastIndexOf('/')); +const sPath = ss.substring(0,ss.lastIndexOf('/')+1); window['keyman'] = new KeymanEngine(SourcemappedWorker.constructInstance(), sPath); \ No newline at end of file diff --git a/web/src/app/webview/src/release-main.ts b/web/src/app/webview/src/release-main.ts index 3758b887d8..033adc846f 100644 --- a/web/src/app/webview/src/release-main.ts +++ b/web/src/app/webview/src/release-main.ts @@ -10,6 +10,6 @@ import { Worker } from '@keymanapp/lexical-model-layer/web' */ const scripts = document.getElementsByTagName('script'); const ss = scripts[scripts.length-1].src; -const sPath = ss.slice(0,ss.lastIndexOf('/')); +const sPath = ss.substring(0,ss.lastIndexOf('/')+1); window['keyman'] = new KeymanEngine(Worker.constructInstance(), sPath); \ No newline at end of file