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.
This commit is contained in:
Eberhard Beilharz 2024-06-03 12:20:02 +02:00
parent 3ee8359f8f
commit 93eabd96ab
No known key found for this signature in database
GPG key ID: E9140597606020D3
2 changed files with 2 additions and 2 deletions

View file

@ -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);

View file

@ -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);