-
-
Notifications
You must be signed in to change notification settings - Fork 193
Fix menubar not ready #453
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
Conversation
Yeh I bumped into this too and opted to have my MenuBar's controller/Livewire component be the thing that spawns the ChildProcess as the timing wasn't too critical for my use-case. You could also do it on a listener of the I'm not sure we should introduce another approach... |
I will try that. Another solution would be to avoid calling state.activeMenuBar.on("ready", () => {
state.activeMenuBar.tray.setTitle(label);
} |
Because creating the menubar is asynchronous and relatively slow (it takes about 1 second for mine, including the context menu and everything), my child process is faster at updating the menubar title (even though it connects to an API ^^). What do you suggest ? Maybe the |
Maybe we need a new event ( state.activeMenuBar.on("ready", () => {
if (! state.activeMenuBar) {
notifyLaravel("events", {
event: "\\Native\\Laravel\\Events\\MenuBar\\MenuBarCreated"
});
}
state.activeMenuBar.tray.setTitle(label);
...
}); |
Suggestion applied and tester with both PR. |
The creation of MenuBar is actually asynchronous, which is not practical in PHP since we cannot use await if necessary.
This gives the ability to call
create
ourselves instead of__destruct
.Fix the following situation in the service provider:
With this PR, we can't take control and wait for the menubar to be ready by:
The repetition of
create
is not ideal. We can change the name of the latter without it being a breaking change.Goes with: NativePHP/electron#150