24 lines
729 B
Cheetah
24 lines
729 B
Cheetah
import {ParentIPC, ChildIPC} from 'kitten-ipc';
|
|
|
|
{{- /*gotype: efprojects.com/kitten-ipc/kitcom/ts.tsGenData*/ -}}
|
|
{{range $e := .Api.Endpoints}}
|
|
export default class {{$e.Name}} {
|
|
private ipc: ParentIPC | ChildIPC;
|
|
|
|
constructor(ipc: ParentIPC | ChildIPC) {
|
|
this.ipc = ipc;
|
|
}
|
|
|
|
{{range $mtd := $e.Methods}}
|
|
async {{ $mtd.Name }}(
|
|
{{ range $par := $mtd.Params }}{{$par.Name}}: {{$par.Type | typedef }}, {{end}}
|
|
): Promise<{{if len $mtd.Ret}}{{(index $mtd.Ret 0).Type | typedef }}{{else}}void{{end}}> {
|
|
const results = await this.ipc.call('{{$mtd.Name}}',
|
|
{{range $par := $mtd.Params}}{{$par.Name}}, {{end}}
|
|
);
|
|
return {{range $ret := $mtd.}}
|
|
}
|
|
{{end}}
|
|
}
|
|
{{end}}
|