70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
import { exportMethod } from "../../lib/decorators/moduleDecorators";
|
|
import { InjectableNopeBaseModule } from "../../lib/module/BaseModule.injectable";
|
|
import { NopeObservable } from "../../lib/observables/nopeObservable";
|
|
import { IF01 } from "./IF01";
|
|
|
|
export interface IF00 {
|
|
// Test property
|
|
hello: "world";
|
|
}
|
|
|
|
export class ComplexModuleWithDecorators extends InjectableNopeBaseModule {
|
|
// @exportProperty({
|
|
// mode: ['publish'],
|
|
// topic: 'propWithInternalDefinition'
|
|
// })
|
|
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;
|
|
}
|
|
|
|
@exportMethod({})
|
|
async exportedMethodWithCallback(
|
|
a: number,
|
|
b: number,
|
|
operator: (a: number, b: number) => Promise<number>
|
|
): Promise<number> {
|
|
return await operator(a, b);
|
|
}
|
|
|
|
@exportMethod({})
|
|
async exportedMethodWithCallbackCallback(
|
|
a: number,
|
|
b: number,
|
|
operator: (
|
|
a: number,
|
|
b: number,
|
|
c: (a: string) => Promise<number>
|
|
) => Promise<number>
|
|
): Promise<number> {
|
|
return await operator(a, 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();
|
|
}
|
|
}
|