Convert app-start/-stop callbacks to async/await (#3035)

supersedes https://github.com/MichMich/MagicMirror/pull/3027 and just
touches the start/stop calls.

---------

Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
Veeck
2023-02-22 18:58:00 +01:00
committed by GitHub
parent 2b792cdbb8
commit fe0b915a5d
5 changed files with 90 additions and 70 deletions

View File

@@ -15,19 +15,15 @@ exports.startApplication = async (configFilename, exec) => {
if (exec) exec;
global.app = require("app.js");
return new Promise((resolve) => {
global.app.start(resolve);
});
return global.app.start();
};
exports.stopApplication = async () => {
if (global.app) {
return new Promise((resolve) => {
global.app.stop(resolve);
delete global.app;
});
if (!global.app) {
return Promise.resolve();
}
return Promise.resolve();
await global.app.stop();
delete global.app;
};
exports.getDocument = () => {