added example service
This commit is contained in:
parent
0c9f186d8a
commit
9b10ff1d14
23
src/bin/HelloWorldService.hx
Normal file
23
src/bin/HelloWorldService.hx
Normal 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);
|
||||
});
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package kernel.binstore;
|
||||
|
||||
import bin.HelloWorldService;
|
||||
import bin.Service;
|
||||
import bin.LSPS;
|
||||
import bin.Turtle;
|
||||
@ -25,7 +26,8 @@ class BinStore {
|
||||
{c: Terminal, name: "Terminal", aliases: ["terminal","term"]},
|
||||
{c: Turtle, name: "Turtle", aliases: ["turtle"]},
|
||||
{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)
|
||||
|
Loading…
Reference in New Issue
Block a user