beyond
Version:
The Full Stack Universal Typescript Framework
46 lines (36 loc) • 1.1 kB
JavaScript
const {ipc} = global.utils;
module.exports = class extends require('./attributes') {
#process;
get process() {
return this.#process;
}
_process() {
const changed = super._process();
if (changed === false) return false;
this.#process?.destroy();
if (!this.configured) return;
const specs = {
is: this.is,
container: {
id: this.container.id,
is: this.container.is,
dashboard: this.container.dashboard,
path: this.container.path,
package: this.container.package
},
port: this.port
};
this.#process = new (require('./process'))(specs);
}
async start() {
await ipc.exec('main', 'beyond-local/start');
return await this.#process?.start();
}
async stop() {
return await this.#process?.stop();
}
destroy() {
this.stop().catch(exc => console.log(exc.stack));
super.destroy();
}
}