fix(core): update

This commit is contained in:
2021-01-28 01:31:42 +00:00
parent 6c2057b119
commit be38e91548
5 changed files with 22 additions and 17 deletions
+8 -5
View File
@@ -46,7 +46,7 @@ export class SmartsocketClient {
public socketRoles = new plugins.lik.ObjectMap<SocketRole>();
// tagStore
private tagStore: {[key: string]: interfaces.ITag} = {};
private tagStore: { [key: string]: interfaces.ITag } = {};
private tagStoreSubscription: plugins.smartrx.rxjs.Subscription;
/**
@@ -66,7 +66,7 @@ export class SmartsocketClient {
*/
public async getTagById(tagIdArg: interfaces.ITag['id']) {
return this.tagStore[tagIdArg];
};
}
/**
* removes a tag from a connection
@@ -164,12 +164,15 @@ export class SmartsocketClient {
// handle connection
this.socketConnection.socket.on('connect', async () => {
this.tagStoreSubscription?.unsubscribe();
this.tagStoreSubscription = this.socketConnection.tagStoreObservable.subscribe(tagStoreArg => {
this.tagStore = tagStoreArg
});
for (const keyArg of Object.keys(this.tagStore)) {
this.socketConnection.addTag(this.tagStore[keyArg]);
}
this.tagStoreSubscription = this.socketConnection.tagStoreObservable.subscribe(
(tagStoreArg) => {
this.tagStore = tagStoreArg;
}
);
this.updateStatus('connected');
});