nope/test/testFile.ts

64 lines
1.6 KiB
TypeScript
Raw Normal View History

2020-08-23 07:28:03 +00:00
import { nopeObservable } from "../lib/observables/nopeObservable";
import { exportsElementsToDispatcher, exportMethodToDispatcher, exportPropertyToDispatcher } from "../lib/dispatcher/nopeDispatcherDecorators";
import { IF01 } from "./testExternalDescriptor";
import { IF02 } from "./testExternalDescriptorReference";
2020-08-23 09:23:38 +00:00
export interface IF00 {
2020-08-24 07:39:55 +00:00
// Test property
2020-08-23 09:23:38 +00:00
hello: 'world'
}
2020-08-24 07:39:55 +00:00
@exportsElementsToDispatcher({
uri: 'test'
})
2020-08-23 07:28:03 +00:00
export class CLWithInterface {
@exportPropertyToDispatcher
exportedAttributeSimple = new nopeObservable<boolean>(false);
@exportPropertyToDispatcher
exportedAttributeComplex = new nopeObservable<{
2020-08-24 07:39:55 +00:00
element01: IF00,
2020-08-23 07:28:03 +00:00
num: number
}>({
2020-08-24 07:39:55 +00:00
element01: {
hello:"world"
},
2020-08-23 07:28:03 +00:00
num: 0
});
2020-08-24 07:39:55 +00:00
/**
*
* Function which will add two Nodes.
* @param a Parameter a
* @param b Parameter b
*/
@exportMethodToDispatcher({
url: 'exportedFunction'
})
async exportedFunction(a: number, b: number, operator: (a: IF00,b: IF01) => Promise<{
test: IF02,
x: string
}>){
// Comment etc.
2020-08-23 07:28:03 +00:00
return await operator(a,b);
}
2020-08-24 07:39:55 +00:00
/**
* Function which will add two Nodes.
* @param a Parameter a
* @param b Parameter b
*/
@exportMethodToDispatcher({
url: 'exportedStringFunction'
})
async exportedStringFunction(a: string, b: string){
// Comment etc.
return "";
}
2020-08-23 07:28:03 +00:00
exportedFunctionWithError(a: number, b: number, operator: (a: number,b: number) => Promise<number>){
return operator(a,b);
}
}