fix(core): update
This commit is contained in:
53
ts/smartdaemon.classes.service.ts
Normal file
53
ts/smartdaemon.classes.service.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import * as plugins from './smartdaemon.plugins';
|
||||
import * as paths from './smartdaemon.paths';
|
||||
import { SmartDaemon } from './smartdaemon.classes.smartdaemon';
|
||||
|
||||
export interface SmartDaemonServiceConstructorOptions {
|
||||
name: string;
|
||||
command: string;
|
||||
workingDir: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* represents a service that is being spawned by SmartDaemon
|
||||
*/
|
||||
export class SmartDaemonService implements SmartDaemonServiceConstructorOptions {
|
||||
public static async createFromOptions(smartdaemonRef: SmartDaemon, optionsArg: SmartDaemonServiceConstructorOptions) {
|
||||
const service = new SmartDaemonService(smartdaemonRef);
|
||||
for (const key of Object.keys(optionsArg)) {
|
||||
service[key] = optionsArg[key];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public options: SmartDaemonServiceConstructorOptions;
|
||||
|
||||
public name: string;
|
||||
public command: string;
|
||||
public workingDir: string;
|
||||
|
||||
public smartdaemonRef: SmartDaemon;
|
||||
|
||||
constructor(smartdaemonRegfArg: SmartDaemon) {
|
||||
this.smartdaemonRef = smartdaemonRegfArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* enables the service
|
||||
*/
|
||||
public async enable() {
|
||||
this.smartdaemonRef
|
||||
}
|
||||
|
||||
/**
|
||||
* disables the service
|
||||
*/
|
||||
public async disable() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* pauses the service
|
||||
*/
|
||||
public pause() {};
|
||||
}
|
Reference in New Issue
Block a user