How to share an instance of a singleton class between two window


#1

Hello. I am working with small electron application, and I want to ask one small question.

I need to share a singleton class instance between different two windows of my app.
“Share” means instance which has each class is the same and variables of the instance are the same.

I used affinity parameter in the BrowserWindow() constructor to run two windows in the same renderer process. I suppose if the two windows run in the same process, the two windows share the instance. But actually, the instance and the values of the instance are different.

Is this a correct behavior?
1.If so, could you tell me another way to share an instance between two windows?
2.If not, is this a bug? Or do I need to set another parameter?