rollback some of wrong code from prev commit
This commit is contained in:
parent
fd02618c2f
commit
f8d55b230d
@ -10,16 +10,12 @@ export default class GoIpcApi {
|
||||
}
|
||||
|
||||
async Div(a: number, b: number): Promise<number> {
|
||||
a = this.ipc.convType(a, "number");
|
||||
b = this.ipc.convType(b, "number");
|
||||
const results = await this.ipc.call("GoIpcApi.Div", a, b);
|
||||
results[0] = this.ipc.convType(results[0], "number");
|
||||
return results[0] as number;
|
||||
}
|
||||
|
||||
async XorData(data1: Buffer, data2: Buffer): Promise<Buffer> {
|
||||
data1 = this.ipc.convType(data1, "Buffer");
|
||||
data2 = this.ipc.convType(data2, "Buffer");
|
||||
const results = await this.ipc.call("GoIpcApi.XorData", data1, data2);
|
||||
results[0] = this.ipc.convType(results[0], "Buffer");
|
||||
return results[0] as Buffer;
|
||||
|
||||
@ -16,11 +16,6 @@ export default class {{ $e.Name }} {
|
||||
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 }}> {
|
||||
|
||||
{{ range $par := $mtd.Params -}}
|
||||
{{ $par.Name }} = this.ipc.convType({{ $par.Name }}, '{{ $par.Type | typedef }}');
|
||||
{{- end -}}
|
||||
|
||||
const results = await this.ipc.call('{{ $e.Name }}.{{ $mtd.Name }}',
|
||||
{{ range $par := $mtd.Params }}{{ $par.Name }}, {{ end }}
|
||||
);
|
||||
|
||||
@ -146,6 +146,7 @@ abstract class IPCCommon {
|
||||
if (result instanceof Promise) {
|
||||
result = await result;
|
||||
}
|
||||
result = this.convType(result);
|
||||
this.sendMsg({type: MsgType.Response, id: msg.id, result: [result]});
|
||||
} catch (err) {
|
||||
this.sendMsg({type: MsgType.Response, id: msg.id, error: `${ err }`});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user