Skip to content
Snippets Groups Projects
Commit c341cf9e authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon:
Browse files

Change property check to `this.hasOwnproperty(name)`

(check for `this[name]` failed for value `false`)
parent 46a6995e
No related branches found
No related tags found
1 merge request!28Observer test
Pipeline #15957 passed with warnings
...@@ -14,7 +14,7 @@ export class Provider extends HTMLElement { ...@@ -14,7 +14,7 @@ export class Provider extends HTMLElement {
this.addEventListener('subscribe', function (e) { this.addEventListener('subscribe', function (e) {
const name = e.detail.name; const name = e.detail.name;
if (that[name] || that.root) { if (that.hasOwnProperty(name) || that.root) {
console.log('Provider(' + that.id + ') eventListener("subscribe",..) name "' + name + '" found.'); console.log('Provider(' + that.id + ') eventListener("subscribe",..) name "' + name + '" found.');
that.callbackStore.push({name: name, callback: e.detail.callback, sender: e.detail.sender}); that.callbackStore.push({name: name, callback: e.detail.callback, sender: e.detail.sender});
...@@ -26,7 +26,7 @@ export class Provider extends HTMLElement { ...@@ -26,7 +26,7 @@ export class Provider extends HTMLElement {
this.addEventListener('unsubscribe', function (e) { this.addEventListener('unsubscribe', function (e) {
const name = e.detail.name; const name = e.detail.name;
const sender = e.detail.sender; const sender = e.detail.sender;
if (that[name] || that.root) { if (that.hasOwnProperty(name) || that.root) {
console.log('Provider(' + that.id + ') eventListener("unsubscribe",..) name "' + name + '" found.'); console.log('Provider(' + that.id + ') eventListener("unsubscribe",..) name "' + name + '" found.');
that.callbackStore.forEach(item => { that.callbackStore.forEach(item => {
if (item.sender === sender && item.name === name) { if (item.sender === sender && item.name === name) {
...@@ -45,7 +45,7 @@ export class Provider extends HTMLElement { ...@@ -45,7 +45,7 @@ export class Provider extends HTMLElement {
const name = e.detail.name; const name = e.detail.name;
const value = e.detail.value; const value = e.detail.value;
if (that[name] || that.root) { if (that.hasOwnProperty(name) || that.root) {
console.log('Provider(' + that.id + ') eventListener("set-property",..) name "' + name + '" found.'); console.log('Provider(' + that.id + ') eventListener("set-property",..) name "' + name + '" found.');
that[name] = value; that[name] = value;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment