-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Open devtools through functions. #2740
Comments
Hi! This has been implemented on master. Details here: https://wails.io/docs/next/reference/cli#build |
I think this has become an issue. -devtools flag does not exist on my build... It needs to be specified without the dash. Then it works. The command does not show up in the help menu. See:
The following help commands are listed:
This is also not completely what I want. Are you sure there is no function to call? I do not mind linking. If there is, what package of the sourcecode might I find it in? |
@Nigel2392 The Although, this not exactly what you're asking for, this will show the context menu along with the devtools when you right-click. I was thinking of adding a runtime function to programmatically open the devtools in production when the devtools/context-menu is not enabled. I did some testing and I was able to do so on Windows, but on Linux it only worked when the devtools is enabled, on Mac the code that is responsible for opening the devtools is only included in debug mode because it uses private API (I'm not a Mac user/dev so I don't know what's that) wails/v2/internal/frontend/desktop/darwin/inspector_dev.go Lines 5 to 6 in 4c7c3d9
@stffabi You wrote this code, what do you think? is it not possible to open the devtools on Mac in production? what about Linux, do you know if it's possible when the devtools isn't enabled like in Windows? |
For context on private APIs: they are APIs that are there, physically callable, but there's no docs and absolutely no guarantees that it will continue working. On top of that, any app that uses one will never pass Apple's app store verification. So it's fine to use if you don't mind it breaking at some point and you're not publishing it. |
Ahh, thanks! Did not see it was for a future release, now I do.
Mind sharing where I can find your concept of opening devtools on Windows/linux through a function call? Sounds interesting! |
Got it, so Mac is out of the question, maybe we could still add this function but it will work according to the platform, if you're on Windows it will always work, on Linux it will work if you build using |
I'm testing on a local fork of Wails, it's not something you can do in your application code. |
We could consider a function but it has to be explicitly enabled. But yeah, is there the demand for it vs the complexity of doing it? |
It's not complex at all, it will just be a runtime function that calls an already existing code on each platform.
It doesn't need an option to enable it, it's just a runtime function, if you need it you call it, say you have an admin area, you can have a button there to open the devtools, it will be most useful on Windows only because you could ship the application with no devtools and still be able to programmatically open in with a password or something. Edit: |
Let's keep this open and if there's more demand for it I could issue a PR. |
The reason I said "you'd need to enable it" is to ensure that by default it doesn't compile in code that calls private APIs. So we may need to hide it behind a build flag. I'd be interested to know if the code is still in the binary, even if it's not enabled in the config (I doubt the DCE is that good). Can be tested by adding |
It's already hidden behind wails/v2/internal/frontend/desktop/darwin/inspector_dev.go Lines 1 to 6 in 4c7c3d9
And in wails/v2/internal/frontend/desktop/darwin/inspector.go Lines 1 to 11 in 4c7c3d9
So in summary, calling this function in |
Hey guys, I need this feature. On the production build, I'd like to enter password or other backdoor to open devtools window. This could greatly help on debugging production build |
Is your feature request related to a problem? Please describe.
Sometimes in your production environments; it can be handy to still have an option to open the devtools.
I say; let the developer choose!
Describe the solution you'd like
Through a custom function in the runtime, possibly only allowed to call the function if a specific application configuration setting is set. The setting might seem redundant, but it could keep developers from making mistakes.
This way a developer can implement their own way to enable a simple debug mode in a production environment, without actually running their app in debug.
This could make the life of tech-support employees or developers easier; allowing them to find the root cause of errors more quickly
Describe alternatives you've considered
None. Deploying in a production environment with debug mode is a no-go.
Additional context
No response
The text was updated successfully, but these errors were encountered: