-
Notifications
You must be signed in to change notification settings - Fork 181
Usage in electron application #143
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
Comments
Hi @grizio! Sorry for the slow feedback on this. Great that you got it working in Electron! Maybe it could be a good idea to create a question/answer on Stack Overflow? That combined with this issue of yours will make it easy for people to google a solution to this. I'm not sure we want to add it to the README as it's a pretty rare use case. What do you think? |
Personally, I would prefer having a simple sentence in the README (in a section troubleshooting) instead of looking for answers in stack overflow when possible, even if it is a link to this Github issue (eg: To use this library in electron application, see #143). But my opinion is maybe different from most people, I do not know the behavior of most people. |
It might be handy to use the memory history implementation when using electron. It is currently used as a fallback when the history api can't be used. For that to work, it would need to be exposed to the api though. A history could be created and passed to the router like so: <script>
import { Router, createHistory, createMemorySource } from "svelte-routing";
const history = createHistory(createMemorySource());
</script>
<Router {history}>
...
</Router> |
@mefechoel would be great if that'd work. i tried it but unfortunately the
i get exceptions that createHistory and createMemorySource are undefined. the basepath approach works for me though, so thanks for that, @grizio! however, if you reload the electron window you'll get an error, because the router pushes this into the history: what would be necessary to provide such a feature? |
I used
svelte-routing
into an electron application on Windows and ended up having some issues.After some investigation, I found the solution (compatible in browser and in electron application for Windows and Linux, not tested on mac):
I needed to add a
basepath
with the disk letter (C:/
,D:/
, …) on top-level router.It could be interesting to update the library to be electron compatible on windows (and other OS). I thought of three ways:
C:/
) directly in theRouter
component as in the above code for every library consumer (I did not find an invalid use case but I could forget one)electron: boolean
onRouter
to enable this specific behaviorI can create the Pull Request once the solution (one of the three above or another) is decided.
Thanks for your library and your time. :pray:
The text was updated successfully, but these errors were encountered: