nope/lib/templates/backendInterface.handlebars

31 lines
1.1 KiB
Handlebars
Raw Normal View History

2020-08-25 10:50:17 +00:00
// Automatic Genearted Backend-Interface
// To update run `npm run build:backend`
import { nopeDispatcher } from "./dispatcher/nopeDispatcher"
{{#each classes}}
2020-09-08 08:46:52 +00:00
import { {{className}} } from "./clients/{{fileName}}";
{{/each}}
{{#each functions}}
import { {{generatorName}} } from "./functions/{{fileName}}";
2020-08-25 10:50:17 +00:00
{{/each}}
export class BackendInterface {
{{#each classes}}
2020-09-08 08:46:52 +00:00
public readonly {{orginalName}}: {{className}};
{{/each}}
{{#each functions}}
public readonly {{orginalName}}: ({{#each params}}{{#if isBaseType}}{{name}}{{#if isOptional}}?{{/if}}: {{{originalCode}}}{{/if}}{{#unless isBaseType}}{{name}}{{#if isOptional}}?{{/if}}: import("./functions/{{../fileName}}").{{{simplifiedType}}}{{/unless}}{{#unless @last}}, {{/unless}}{{/each}}) => Promise<{{{returnType.simplifiedSubType}}}>;
2020-08-25 10:50:17 +00:00
{{/each}}
constructor(protected _dispatcher: nopeDispatcher){
{{#each classes}}
this.{{orginalName}} = new {{className}}(_dispatcher);
{{/each}}
2020-09-08 08:46:52 +00:00
{{#each functions}}
this.{{orginalName}} = {{generatorName}}(_dispatcher);
{{/each}}
2020-08-25 10:50:17 +00:00
}
}