Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on mobile because window.process is undefined #23

Open
jose-elias-alvarez opened this issue Dec 12, 2024 · 1 comment
Open

Comments

@jose-elias-alvarez
Copy link

As suggested in the README, I tried overriding isDesktopOnly and running the plugin on iOS, but it fails to load because of this line, since window.process is undefined on mobile:

const watchNeeded = window.process.platform !== "darwin" && window.process.platform !== "win32";

Based on your comment, I tried updating this to instead use Obsidian's Platform to check more directly for Linux and Android:

const watchNeeded = Platform.isAndroidApp || Platform.isLinux;

With this change, hot reloading works for me on macOS, iOS, and iPadOS. I'd contribute it as a PR, but I'm not 100% confident about the logic and do not have Linux / Android devices to test on.

I'm also seeing an error in the mobile console, though it doesn't seem to actually interfere with hot reloading:

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'this.app.vault.adapter.watchers.hasOwnProperty')

The error itself is trivially solved by checking if watchers is defined, but again, I'm not confident enough in the fix, so I thought I'd raise the issue for now.

@pjeby
Copy link
Owner

pjeby commented Dec 15, 2024

Man I really need to get this project on Typescript and a proper build. Ah well, thanks for the report, I've just put in fixes for 0.1.14, though I went a bit more conservative with the process stuff and kept it to "not windows or MacOS" for now. Please let me know if there are any console errors with the new version and I will tune up accordingly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants