2020-11-06 08:10:30 +00:00
|
|
|
/**
|
|
|
|
* @author Martin Karkowski
|
|
|
|
* @email m.karkowski@zema.de
|
|
|
|
* @create date 2020-11-06 08:52:45
|
2020-12-04 18:10:33 +00:00
|
|
|
* @modify date 2020-12-02 08:56:41
|
2020-11-06 08:10:30 +00:00
|
|
|
* @desc [description]
|
|
|
|
*/
|
|
|
|
|
2020-12-04 18:10:33 +00:00
|
|
|
import {
|
|
|
|
IFunctionOptions,
|
|
|
|
INopeModule,
|
2022-01-10 06:52:05 +00:00
|
|
|
IEventOptions,
|
2020-12-04 18:10:33 +00:00
|
|
|
} from "../types/nope/nopeModule.interface";
|
2020-11-05 17:01:38 +00:00
|
|
|
|
|
|
|
/**
|
2022-01-10 06:52:05 +00:00
|
|
|
* Decorator, used to export the Method as Service to Nope..
|
|
|
|
* @param options The options used for linking.
|
2020-11-05 17:01:38 +00:00
|
|
|
*/
|
2022-01-10 06:52:05 +00:00
|
|
|
export function nopeMethod(options: IFunctionOptions) {
|
2020-12-04 18:10:33 +00:00
|
|
|
return function (
|
|
|
|
target: INopeModule,
|
|
|
|
methodName: string,
|
|
|
|
descriptor: PropertyDescriptor
|
|
|
|
) {
|
|
|
|
target._markedElements = target._markedElements || [];
|
|
|
|
target._markedElements.push({
|
|
|
|
accessor: methodName,
|
|
|
|
options,
|
2021-12-04 07:25:26 +00:00
|
|
|
type: "method",
|
2020-12-04 18:10:33 +00:00
|
|
|
});
|
|
|
|
};
|
2020-11-05 17:01:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-01-10 06:52:05 +00:00
|
|
|
* Decorator, will link the Parameter to Nope and make it available. it available as
|
|
|
|
* Nope-Property.
|
|
|
|
* @param options The Options, describing the settings for linking.
|
2020-11-05 17:01:38 +00:00
|
|
|
*/
|
2022-01-10 06:52:05 +00:00
|
|
|
export function nopeProperty(options: IEventOptions) {
|
2020-12-04 18:10:33 +00:00
|
|
|
return function (
|
|
|
|
target: INopeModule,
|
|
|
|
propertyKey: string,
|
|
|
|
descriptor: PropertyDescriptor
|
|
|
|
) {
|
|
|
|
target._markedElements = target._markedElements || [];
|
|
|
|
target._markedElements.push({
|
|
|
|
accessor: propertyKey,
|
|
|
|
options,
|
2021-12-04 07:25:26 +00:00
|
|
|
type: "prop",
|
2020-12-04 18:10:33 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
2022-01-10 06:52:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Decorator, that will link the Parameter to Nope and make it available as
|
|
|
|
* Event Emitter.
|
|
|
|
* @param options The Options, describing the settings for linking.
|
|
|
|
*/
|
|
|
|
export function nopeEmitter(options: IEventOptions) {
|
|
|
|
return function (
|
|
|
|
target: INopeModule,
|
|
|
|
propertyKey: string,
|
|
|
|
descriptor: PropertyDescriptor
|
|
|
|
) {
|
|
|
|
target._markedElements = target._markedElements || [];
|
|
|
|
target._markedElements.push({
|
|
|
|
accessor: propertyKey,
|
|
|
|
options,
|
|
|
|
type: "event",
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|