Fixing Module nam

This commit is contained in:
Martin Karkowski 2020-12-30 19:57:03 +01:00
parent a129043a8d
commit 1577a583d8
2 changed files with 46 additions and 42 deletions

View File

@ -2,46 +2,46 @@
* @author Martin Karkowski * @author Martin Karkowski
* @email m.karkowski@zema.de * @email m.karkowski@zema.de
* @create date 2020-11-06 16:53:43 * @create date 2020-11-06 16:53:43
* @modify date 2020-11-07 01:06:36 * @modify date 2020-12-30 18:37:18
* @desc [description] * @desc [description]
*/ */
import { HelloWorldModuleWithDecorators } from './helloworldWithDecorators.module'; import { IPackageDescription } from "../../../lib/types/nope/nopePackage.interface";
import { IPackageDescription } from "../../../lib/types/nope/nopePackage.interface" import { HelloWorldModuleWithDecorators } from "./helloworldWithDecorators.module";
const TYPES = { const TYPES = {
'helloworld': Symbol.for('helloworld') helloworld: Symbol.for("helloworld")
} };
export const DESCRIPTION: IPackageDescription<typeof TYPES> = { export const DESCRIPTION: IPackageDescription<typeof TYPES> = {
activationHandlers: [], activationHandlers: [],
autostart: {}, autostart: {},
defaultInstances: [ defaultInstances: [
{ {
selector: 'helloworld', selector: "helloworld",
options: { options: {
identifier: "instance01", identifier: "instance01",
type: "helloworld", type: "helloworld",
params: [] params: []
} }
} }
], ],
nameOfPackage: 'helloworldpackage', nameOfPackage: "helloworldpackage",
providedClasses: [ providedClasses: [
{ {
description: { description: {
name: 'helloworld', name: "helloworld",
selector: TYPES.helloworld, selector: TYPES.helloworld,
type: HelloWorldModuleWithDecorators type: HelloWorldModuleWithDecorators
}, },
settings: { settings: {
allowInstanceGeneration: true, allowInstanceGeneration: true
} }
} }
], ],
providedFunctions: [], providedFunctions: [],
requiredPackages: [], requiredPackages: [],
types: TYPES types: TYPES
} };
export default DESCRIPTION; export default DESCRIPTION;

View File

@ -14,7 +14,7 @@ export class HelloWorldModuleWithDecorators
implements IHelloWorlModule { implements IHelloWorlModule {
@exportProperty({ @exportProperty({
mode: ["publish"], mode: ["publish"],
topic: "string", topic: "testProp",
schema: {} schema: {}
}) })
public testProp = new NopeObservable<string>(); public testProp = new NopeObservable<string>();
@ -22,7 +22,9 @@ export class HelloWorldModuleWithDecorators
@exportProperty({ @exportProperty({
mode: ["publish"], mode: ["publish"],
topic: "currentTime", topic: "currentTime",
schema: {} schema: {
type: "string"
}
}) })
public currentTime = new NopeObservable<string>(); public currentTime = new NopeObservable<string>();
@ -70,7 +72,7 @@ export class HelloWorldModuleWithDecorators
} }
}) })
async updateTestProp() { async updateTestProp() {
this.testProp.setContent("Internally Updated"); this.testProp.setContent("Internally Updated using updateTestProp()");
} }
/** /**
@ -111,6 +113,8 @@ export class HelloWorldModuleWithDecorators
); );
} }
protected _interval: any;
async init() { async init() {
this.author = { this.author = {
forename: "Martin", forename: "Martin",
@ -126,13 +130,12 @@ export class HelloWorldModuleWithDecorators
await super.init(); await super.init();
// Every 1000 ms publish an update of the current time. // Every 1000 ms publish an update of the current time.
setInterval(() => { this._interval = setInterval(() => {
_this.currentTime.setContent(new Date().toISOString()); _this.currentTime.setContent(new Date().toISOString());
}, 1000); }, 1000);
const _this = this; const _this = this;
this.testProp.setContent("INITAL_VALUE");
this.testProp = new NopeObservable();
this.testProp.subscribe((value, sender) => { this.testProp.subscribe((value, sender) => {
console.log( console.log(
@ -146,7 +149,8 @@ export class HelloWorldModuleWithDecorators
} }
async dispose() { async dispose() {
await super.dispose(); clearInterval(this._interval);
console.log("Deleting Module"); console.log("Deleting Module");
await super.dispose();
} }
} }