31 lines
975 B
TypeScript
31 lines
975 B
TypeScript
|
import { IFunctionOptions, INopeModule, IPropertyOptions } from "../types/nopeModule.interface";
|
||
|
|
||
|
/**
|
||
|
* Decorator, used to export the Method.
|
||
|
* @param options
|
||
|
*/
|
||
|
export function exportMethod(options: IFunctionOptions) {
|
||
|
return function (target: INopeModule, methodName: string, descriptor: PropertyDescriptor) {
|
||
|
target._markedElements = target._markedElements || [];
|
||
|
target._markedElements.push({
|
||
|
accessor: methodName,
|
||
|
options,
|
||
|
type: 'method'
|
||
|
});
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Decorator, will create a POST and GET api for the Parameter.
|
||
|
* @param options
|
||
|
*/
|
||
|
export function exportProperty(options: IPropertyOptions) {
|
||
|
return function (target: INopeModule, propertyKey: string, descriptor: PropertyDescriptor) {
|
||
|
target._markedElements = target._markedElements || [];
|
||
|
target._markedElements.push({
|
||
|
accessor: propertyKey,
|
||
|
options,
|
||
|
type: 'prop'
|
||
|
});
|
||
|
};
|
||
|
}
|