Adding some Readme stuff

This commit is contained in:
K35
2022-01-03 21:08:25 +00:00
parent aa983c9960
commit 99563959c6
3 changed files with 15 additions and 5 deletions

View File

@ -308,10 +308,15 @@ export class TypescriptTarget extends CompileTarget {
(e) => `${e.name}: ${toJSType(e.type) + (e.array ? "[]" : "")}`
)
.join(", ");
//TODO: Prio 1 : Verify and strip input parameters
//TODO: Prio 2 : Add optional parameters to this and the declaration file
// const verifyInputs = () => {
// }
if (!fnc.return) {
a(1, `${fnc.name}(${params}): void {`);
a(1, `${fnc.name}(${params}): void {`);1
a(2, `this._provider.sendMessage({`);
a(3, `jsonrpc: "2.0",`);
a(3, `method: "${def.name}.${fnc.name}",`);
@ -334,11 +339,11 @@ export class TypescriptTarget extends CompileTarget {
a(3, `});`);
a(2, `}).then(result => {`);
if (fnc.return.array) {
a(2, `for(const elm of result) {`);
a(3, `apply_${fnc.return.type}(elm);`);
a(2, `}`);
a(3, `for(let i = 0; i < result.length; i++) {`);
a(4, `result[i] = apply_${fnc.return.type}(result[i]);`);
a(3, `}`);
} else {
a(3, `apply_${fnc.return.type}(result);`);
a(3, `result = apply_${fnc.return.type}(result);`);
}
a(3, `return result;`);
a(2, `});`);