nope/test/modules/ComplexModule.ts
2020-11-05 18:02:01 +01:00

51 lines
1.3 KiB
TypeScript

import { exportMethod, exportProperty } from "../../lib/decorators/moduelDecorators";
import { NopeBaseModule } from "../../lib/module/BaseModule";
import { NopeObservable } from "../../lib/observables/nopeObservable";
import { IF01 } from "./IF01";
export interface IF00 {
// Test property
hello: 'world'
}
export class ComplexModuleWithDecorators extends NopeBaseModule {
@exportProperty({
mode: ['publish'],
topic: 'propWithInternalDefinition',
schema: {
}
})
public propWithInternalDefinition = new NopeObservable<IF00>();
/**
* Function description
*
* @param {IF00} a Description of Parameter a
* @param {IF01} [b] Description of Optional Parameter b
* @return {*} {Promise<IF01>}
* @memberof ComplexModuleWithDecorators
*/
@exportMethod({})
async exportedMethod(a: IF00, b?: IF01): Promise<IF01> {
b.name = a.hello;
return b;
}
async init() {
this.author = {
forename: 'Martin',
mail: 'm.karkowski@zema.de',
surename: 'karkowski'
}
this.description = 'A Complex Module for Testing.'
this.type = 'helloworld';
this.version = {
date: new Date('05.11.2020'),
version: 1
}
await super.init();
}
}