This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
Thanks for all the effort you are putting in Alva and the given lightning talk at JSConf EU 2018.
I have been looking at Alva's code and realised there are some redundant listeners. So I thought I could contribute to it a little bit.
There is no open issue about this. So I hope it's not a problem that I am just trying to fix a thing I have found on my own without creating an issue here.
The issue is; whenever a user closes and opens a window in Alva, listeners which are in
src/electron/main.ts
file were re-attached. Therefore, after closing & opening Alva window several times, the actions in listeners were executed as many as it's re-opened. Then for example, if a user tries to open an existing Alva file, (s)he sees multiple "open file" dialog.A screenshot when an existing Alva file is opened after I re-opened Alva's window five times;
For the review; I would suggest reading the file. Because here, the change does not look like properly. What I have done is; I have taken the server creation and the listeners out of
createWindow
and put it in an IIFE (since that part was async and there is no top-level async support) in order to avoid the redundant load and fix the application behaviour for user experience.