-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Use inversify to build the example electron app #4869
Conversation
dev-packages/application-manager/src/generator/frontend-generator.ts
Outdated
Show resolved
Hide resolved
dev-packages/application-manager/src/generator/frontend-generator.ts
Outdated
Show resolved
Hide resolved
a18fd67
to
d976534
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runs locally and LGTM. Probably needs another pair of eyes on it as I'm not too learned in this area of Theia :)
I will have a look later today, had to fix theia-apps next images first, second time this week 🙈 |
Wrapping communications between main and renderer processes into JSON-RPC services would be cool next step. Then we will have aligned arch for all processes. |
Do you want me to set that up in this PR or would it be a follow up? |
@marechal-p separately |
d976534
to
cfaed14
Compare
packages/core/src/electron-main/electron-native-keymap-service.ts
Outdated
Show resolved
Hide resolved
cfaed14
to
c6347b2
Compare
@akosyakov the PR is already approved but since you had comment I am waiting for yours. |
@kittaakos Could you have a look that control flow is still good for bundled electron apps? |
@marechal-p sorry i would need more time with this code which i don't have now (support of VS Code extension is more important). Looking at the code i don't think contribution points are properly designed. Usually we have an app which does start up and then lifecycle contributions allow to participate, in this PR it seems that lifecycle contribution does the startup like creating windows, making sure that state is stored. It should not be like that. |
I could, but you'll have to wait till next week though. |
Indeed, I just didn't know who else to ping that would like to have a look at that, I know you made the setup for frontend/backend so I figured you'd have comments.
Ah yes, I wasn't so sure how to handle it. My original idea was to allow clients to almost entirely define the way they want to handle the lifecycle for the electron application, without imposing ours. I can see how to improve that.
Perfect, thank you :) |
fac8de5
to
96215a6
Compare
5a1704c
to
2048a26
Compare
@kittaakos I am not 100% convinced that the lifecycle management is perfect, but maybe you have some advices/opinions already? |
2048a26
to
ec77411
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, the startup is way faster than before. 👍
I have added a few remarks here and there; I am happy to try it again if you have any updates/changes. If you have any questions, or you disagree with any of my comments, please let me know.
dev-packages/application-manager/src/generator/frontend-generator.ts
Outdated
Show resolved
Hide resolved
dev-packages/application-manager/src/generator/frontend-generator.ts
Outdated
Show resolved
Hide resolved
dev-packages/application-manager/src/generator/frontend-generator.ts
Outdated
Show resolved
Hide resolved
dev-packages/application-manager/src/generator/frontend-generator.ts
Outdated
Show resolved
Hide resolved
@kittaakos could you finish the review please? I won't have time to have a look and don't want to stay in the way much. @marechal-p let's go with whatever you have now and refactor it later then |
👍 Sure. |
ec77411
to
9f8c716
Compare
@marechal-p do you still plan on continuing your work on the PR? I think it's really interesting and will also make it a lot easier for devs in the future to update the Electron part of the application while also improving startup time :) |
I mean, I was pretty much done. Unless someone sees something missing. I can rebase. |
Every new logic that should happen in the Electron main process currently has to be written inside the generators. This is difficult to extend. This commit refactorize the `electron-main.js` script to use inversify in order to customize the logic happening when launching an electron application. Signed-off-by: Paul Maréchal <[email protected]>
9f8c716
to
b0759f9
Compare
event.preventDefault(); | ||
let preventStop = false; | ||
// Ask all opened windows whether they want to prevent the \`close\` event or not. | ||
for (const window of electron.BrowserWindow.getAllWindows()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased using gitpod, but I think I should test that locally, really don't know where to move this code right now.
The use case was raised internally to be able to customize the electron main process. According to @akosyakov earlier comments, I am rewriting a new PR which will connect electron-renderer processes and the electron-main process using our JsonRpcProxies. Changes should be better than the current PR, so I will close this and open a new one when ready. |
Every new logic that should happen in the Electron main process
currently has to be written inside the generators. This is difficult to
extend.
This commit refactorize the
electron-main.js
script to use inversifyin order to customize the logic happening when launching an electron
application.
Signed-off-by: Paul Maréchal [email protected]
This should begin to align Electron application development with the frontend/backend extensions.