Adding Comments. Renaming function for better readability.

This commit is contained in:
Martin Karkowski 2021-01-03 13:02:29 +01:00
parent 0e264da630
commit 8f92b8c491

View File

@ -2,7 +2,7 @@
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2020-10-12 18:52:00
* @modify date 2021-01-03 11:06:25
* @modify date 2021-01-03 12:49:44
* @desc [description]
*/
@ -465,7 +465,7 @@ export class nopeDispatcher implements INopeDispatcher {
try {
let _type = _description.type;
if (!this._internalGenerators.has(_type)) {
// No default type is present for a remote
// => assing the default type which is "*""
@ -876,7 +876,7 @@ export class nopeDispatcher implements INopeDispatcher {
data.dispatcher,
data
);
_this._updateExternalEvents(data.dispatcher);
_this._updateExternalObservables(data.dispatcher);
if (this._logger?.enabledFor(Logger.DEBUG)) {
// If there is a Logger:
this._logger.debug(
@ -1063,7 +1063,7 @@ export class nopeDispatcher implements INopeDispatcher {
this._updateExternalServices();
this._updateExternalGenerators();
this._updateExternalEvents();
this._updateExternalObservables();
this._updateExternalInstances();
if (!quite) {
@ -1263,7 +1263,7 @@ export class nopeDispatcher implements INopeDispatcher {
}
/**
* Function to update the used Services.
* Function to update the used Generators.
*
* @protected
* @memberof serviceRegistry
@ -1288,7 +1288,7 @@ export class nopeDispatcher implements INopeDispatcher {
* @protected
* @memberof nopeDispatcher
*/
protected _updateExternalEvents(externalDispatcher = "") {
protected _updateExternalObservables(externalDispatcher = "") {
const _this = this;
// Clear the Services
@ -1312,12 +1312,17 @@ export class nopeDispatcher implements INopeDispatcher {
[..._subscribed].filter((item) => !_this._externalSubscribed.has(item))
);
if (externalDispatcher !== "")
if (externalDispatcher !== "") {
// Make shure, that the subscribed elements of the
// new element are added correctly.
this._mappingOfRemoteDispatchersAndPropsOrEvents
.get(externalDispatcher)
.subscribed.map((item) => _newlySubscribed.add(item));
}
// 2. Iterate over the Elements:
// 2. Iterate over the Elements and
// add the lastly available value.
// TODO: CHECK IF REQUIRED.
for (const _topic of _newlySubscribed) {
if (this._lastPublishedEvent.has(_topic)) {
// Send the Element
@ -1399,7 +1404,7 @@ export class nopeDispatcher implements INopeDispatcher {
* for the given topic.
*
* @param {string} topic The topic to test.
* @return {boolean} The result of the test.
* @return {boolean} The result of the test. True if an external subscription exsits
* @memberof nopeDispatcher
*/
public subscriptionExists(topic: string) {
@ -1411,7 +1416,7 @@ export class nopeDispatcher implements INopeDispatcher {
* the given type idenfitier
*
* @param {string} typeIdentifier Identifier of the type.
* @return {boolean} The result of the test.
* @return {boolean} The result of the test. True if an external generator exsits.
* @memberof nopeDispatcher
*/
public generatorExists(typeIdentifier: string) {