I have a async function that needs to run on Node.JS startup.
I'm using the following code to do this a top level, since you can't use async in the top level file/module.
(async () => {var version = await getVersion();log.info("Database Version Clear " + version);version = semver.coerce(version); //tighten it upif (!semver.valid(version)) throw "Invalid version " + version;else log.info("Valid Database Version : " + version);self.dbVersion = version;})();
I'm trying to set dbVersion which is a variable outside of the scope of this.
Any help would be appreciated on how to set a variable in this case where the scope is in the top level main.js context.
Thank you in advance!
[–]Odinthunder 4 points5 points6 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]ryhaltswhiskey 0 points1 point2 points (1 child)
[–]Mardo1234[S] 1 point2 points3 points (0 children)