'Is it possible to load modules while doing other work?
I'm starting an Electron project and I'm wondering if it is possible (and/or worth it) to do some work (e.g. loading settings from a file) while setting up the NodeJS/Electron environment (i.e. importing modules).
This is what I have so far:
import * as settings from "./settings";
let appSettings: settings.Settings;
settings.initializeSettings() // returns Promise<settings.Settings>
.then(ps => {
appSettings = ps;
/* rest of the code should go here,
but only AFTER the imports are also done. */
});
import { app, BrowserWindow } from "electron"; // do this parallel
/* more imports */
initializeSettings is an async/await function, but if I understand correctly, does not actually open another thread, correct? So would it make sense to use Worker Threads and if so, how would go implement this here?
Thank you in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
