# Where to execute initialization functions in Angular /w Electron?

I am using Angular and Electron, and I have a Preferences object I would like to initialize (Preferences.init()) which needs to be executed before any other code is executed. Does Angular or Electron have a specific location where such initialization code should be executed?

At the moment I put it into the constructor of AppComponent but since the function is asynchronous, I have a race condition and occasionally the data is not properly initialized when needed. Any help or suggestion is highly appreciated! Thanks!

Source: Angular Questions