You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
currently i am using the MessageBoxOnClose option to trigger a confirmation before closing the application but was wondering if there are a way to dynamically hide the MessageBoxOnClose depending on the state of the application?
The text was updated successfully, but these errors were encountered:
I've ran into an instance where I need to change MessageBoxOnClose dynamically. I'm happy to try to implement this functionality, but I need a bit of guidance on the preferred solution.
One solution I see is to implement a Go based e.PreventDefault as mentioned in #48. Another solution could be to allow users to intercept a close event so they can run their own handler.
I'm not too sure what would be best, as I haven't dug into astilectron's architecture`, have you got any suggestions?
Add func(w *Window) UpdateCustomOptions(o WindowCustomOptions) in GO that would send an event window.cmd.update.custom.options to JS with the new options
In JS, store the content of json in a global variable here (same idea as elements variable)
Stop relying on the json local variable here, but rely on the global variable created previously instead
Listen to the new event in JS, and update the global variable accordingly. That way, when the close event is fired, it takes the last MessageBoxOnClose option
* Add UpdateCustomOptions Event
* Added test for custom option event
* Changed from synchronousEvent to write
* update comment
* Changed to synchronousEvent with new event
* changed update to updated
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
currently i am using the MessageBoxOnClose option to trigger a confirmation before closing the application but was wondering if there are a way to dynamically hide the MessageBoxOnClose depending on the state of the application?
The text was updated successfully, but these errors were encountered: