added example service

This commit is contained in:
Djeeberjr 2023-05-29 21:49:41 +02:00
parent 0c9f186d8a
commit 9b10ff1d14
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,23 @@
package bin;
import kernel.log.Log;
import kernel.Timer;
import kernel.ps.ProcessHandle;
import kernel.ps.Process;
class HelloWorldService implements Process {
public function new() {}
public function run(handle:ProcessHandle) {
Log.debug("HelloWorldService started");
handle.write("Hello World! Started\n");
this.startTimer(handle);
}
public function startTimer(handle: ProcessHandle) {
new Timer(1000, function() {
handle.write("Hello World!\n");
this.startTimer(handle);
});
}
}

View File

@ -1,5 +1,6 @@
package kernel.binstore; package kernel.binstore;
import bin.HelloWorldService;
import bin.Service; import bin.Service;
import bin.LSPS; import bin.LSPS;
import bin.Turtle; import bin.Turtle;
@ -25,7 +26,8 @@ class BinStore {
{c: Terminal, name: "Terminal", aliases: ["terminal","term"]}, {c: Terminal, name: "Terminal", aliases: ["terminal","term"]},
{c: Turtle, name: "Turtle", aliases: ["turtle"]}, {c: Turtle, name: "Turtle", aliases: ["turtle"]},
{c: LSPS, name: "PM", aliases: ["lsps"]}, {c: LSPS, name: "PM", aliases: ["lsps"]},
{c: Service, name: "Service", aliases: ["service","srv"]} {c: Service, name: "Service", aliases: ["service","srv"]},
{c: HelloWorldService, name: "HelloWorldService", aliases: ["hello-service"] }
]; ];
@:allow(kernel.Init) @:allow(kernel.Init)