I am looking for a way to reliably get the location of a file where JS Engine's snippet is executed. Is there a way to do so? app.workspace.getActiveFile() can be unreliable when we have multiple tabs with JS Engine open and we reload Obsidian. That would cause all such tabs to have same active file, which is technically correct, but throws off all my scripts. Granted reloading Obsidian is something that doesn't occur often, but when it is necessary, it makes a mess.
I am looking for a way to reliably get the location of a file where JS Engine's snippet is executed. Is there a way to do so?
app.workspace.getActiveFile()
can be unreliable when we have multiple tabs with JS Engine open and we reload Obsidian. That would cause all such tabs to have same active file, which is technically correct, but throws off all my scripts. Granted reloading Obsidian is something that doesn't occur often, but when it is necessary, it makes a mess.