In my electron application I would like to save the window width & height in a config file when it gets resized. I looked up the documentation and found
resize event. I attached the event to the main browser window and when the window gets resized, the event is fired and I get new width & height of the window. So far so good.
However what I noticed is that this event gets fired when I move the window as well (I am simply moving the window and not doing any resizing). Considering I would need to save the window width and height in a config file (i.e. performing IO operation), I think there would be a significant performance hit.
So my questions are:
Is this a bug or expected behavior for resize event to fire even when I move the window?
How to handle the scenario when the window is genuinely resized?
What are the best practices to persist window size in a config file?
Is there an event that gets fired when the window has been resized?
Any help regarding this will be highly appreciated.