diff --git a/packages/auth/README.md b/packages/auth/README.md index 91839c7ca09a8e786e104b5ca5d6f7b52156bcad..9b1a061b2c05ebe3fa4433ead2f404b88fa1713c 100644 --- a/packages/auth/README.md +++ b/packages/auth/README.md @@ -38,7 +38,7 @@ npm i @dbp-toolkit/auth ### Emitted attribute -The component emits a `set-property` event for the attribute `auth`: +The component emits a `dbp-set-property` event for the attribute `auth`: - `auth.subject`: Keycloak username - `auth.token`: Keycloak token to send with your requests diff --git a/packages/auth/src/auth-keycloak.js b/packages/auth/src/auth-keycloak.js index fd4ddfea5622ddd4a732a5ba60bdd5f491626ba6..f72d7dd3ed737a19bff6a5f5748a501ba555542a 100644 --- a/packages/auth/src/auth-keycloak.js +++ b/packages/auth/src/auth-keycloak.js @@ -10,7 +10,7 @@ import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element"; * Keycloak auth web component * https://www.keycloak.org/docs/latest/securing_apps/index.html#_javascript_adapter * - * Emits a set-property event for the attribute "auth": + * Emits a dbp-set-property event for the attribute "auth": * auth.subject: Keycloak username * auth.token: Keycloak token to send with your requests * auth.user-full-name: Full name of the user diff --git a/packages/provider/src/adapter-lit-element.js b/packages/provider/src/adapter-lit-element.js index 3635d6e55e7f00cbfd1832a27f10ed93f18cbea6..fc61bdbee9ac94b0dfa2b29e89a15b34df47a668 100644 --- a/packages/provider/src/adapter-lit-element.js +++ b/packages/provider/src/adapter-lit-element.js @@ -80,10 +80,10 @@ export class AdapterLitElement extends LitElement { const that = this; - this.addEventListener('subscribe', function (e) { + this.addEventListener('dbp-subscribe', function (e) { const name = e.detail.name; if (that.hasProperty(name) || that.root) { - console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("subscribe",..) name "' + name + '" found.'); + console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-subscribe",..) name "' + name + '" found.'); that.callbackStore.push({name: name, callback: e.detail.callback, sender: e.detail.sender}); e.detail.callback(that.getProperty(name)); @@ -91,11 +91,11 @@ export class AdapterLitElement extends LitElement { } }, false); - this.addEventListener('unsubscribe', function (e) { + this.addEventListener('dbp-unsubscribe', function (e) { const name = e.detail.name; const sender = e.detail.sender; if (that.hasProperty(name) || that.root) { - console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("unsubscribe",..) name "' + name + '" found.'); + console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.'); that.callbackStore.forEach(item => { if (item.sender === sender && item.name === name) { const index = that.callbackStore.indexOf(item); @@ -185,7 +185,7 @@ export class AdapterLitElement extends LitElement { const local = pair[0]; const global = pair[1] || local; const that = this; - const event = new CustomEvent('subscribe', + const event = new CustomEvent('dbp-subscribe', { bubbles: true, composed: true, @@ -224,7 +224,7 @@ export class AdapterLitElement extends LitElement { console.log('AdapterLitElement(' + this.tagName + ') unSubscribeProviderFor( ' + element + ' )'); const pair = element.trim().split(':'); const global = pair[1] || pair[0]; - const event = new CustomEvent('unsubscribe', + const event = new CustomEvent('dbp-unsubscribe', { bubbles: true, composed: true, @@ -302,7 +302,7 @@ export class AdapterLitElement extends LitElement { * @returns {boolean} */ sendSetPropertyEvent(name, value) { - const event = new CustomEvent("set-property", { + const event = new CustomEvent('dbp-set-property', { bubbles: true, composed: true, detail: {'name': name, 'value': value} diff --git a/packages/provider/src/provider.js b/packages/provider/src/provider.js index fc3aff38c9ac5b246e7b773cf6bb4e8dbb5576fa..26e885f2f30c4eb12d465fcbf92e980403090795 100644 --- a/packages/provider/src/provider.js +++ b/packages/provider/src/provider.js @@ -37,10 +37,10 @@ export class Provider extends HTMLElement { const that = this; - this.addEventListener('subscribe', function (e) { + this.addEventListener('dbp-subscribe', function (e) { const name = e.detail.name; if (that.hasProperty(name) || that.root) { - console.log('Provider(' + that.id + ') eventListener("subscribe",..) name "' + name + '" found.'); + console.log('Provider(' + that.id + ') eventListener("dbp-subscribe",..) name "' + name + '" found.'); that.callbackStore.push({name: name, callback: e.detail.callback, sender: e.detail.sender}); e.detail.callback(that.getProperty(name)); @@ -48,11 +48,11 @@ export class Provider extends HTMLElement { } }, false); - this.addEventListener('unsubscribe', function (e) { + this.addEventListener('dbp-unsubscribe', function (e) { const name = e.detail.name; const sender = e.detail.sender; if (that.hasProperty(name) || that.root) { - console.log('Provider(' + that.id + ') eventListener("unsubscribe",..) name "' + name + '" found.'); + console.log('Provider(' + that.id + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.'); that.callbackStore.forEach(item => { if (item.sender === sender && item.name === name) { const index = that.callbackStore.indexOf(item); @@ -66,12 +66,12 @@ export class Provider extends HTMLElement { }, false); // listen to property changes - this.addEventListener('set-property', function (e) { + this.addEventListener('dbp-set-property', function (e) { const name = e.detail.name; const value = e.detail.value; if (that.hasProperty(name) || that.root) { - console.log('Provider(' + that.id + ') eventListener("set-property",..) name "' + name + '" found.'); + console.log('Provider(' + that.id + ') eventListener("dbp-set-property",..) name "' + name + '" found.'); that.setProperty(name, value); that.callbackStore.forEach(item => {