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
createourselves 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
createis not ideal. We can change the name of the latter without it being a breaking change.Goes with: NativePHP/electron#150