From afdb63bd85f9f0f3f54c547e1dbc7da22f804182 Mon Sep 17 00:00:00 2001 From: Krakor Date: Thu, 7 Sep 2023 15:01:45 +0200 Subject: [PATCH] fix mobile importJs --- src/api/API.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/API.ts b/src/api/API.ts index 2b29a6b..478337a 100644 --- a/src/api/API.ts +++ b/src/api/API.ts @@ -38,7 +38,13 @@ export class API { * @param path the vault relative path of the file to import */ public async importJs(path: string): Promise { - const fullPath = this.app.vault.adapter.getResourcePath(path); + let fullPath = this.app.vault.adapter.getResourcePath(path); + if (!fullPath.includes('?')) { + const scriptFile = this.app.metadataCache.getFirstLinkpathDest(path, "") + if (scriptFile) { + fullPath += '?' + scriptFile.stat.mtime + } + } return import(fullPath); }