From 8598d6ab28da7ba4827af003eab771c3982c7260 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 21 Oct 2020 16:16:15 +0200
Subject: [PATCH] Make the event name shorter and send an object instead of
 just the data

This way we can extend the message with more data in the future if needed.
---
 packages/qr-code-scanner/README.md              | 2 +-
 packages/qr-code-scanner/src/qr-code-scanner.js | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/packages/qr-code-scanner/README.md b/packages/qr-code-scanner/README.md
index 5d170424..343d7c05 100644
--- a/packages/qr-code-scanner/README.md
+++ b/packages/qr-code-scanner/README.md
@@ -31,7 +31,7 @@ after loaded. This attribute is also used to stop the QR code reader or if you d
 
 ## Events
 
-- `'dbp-qr-code-scanner-data'`: Outgoing Event which is fired if a QR code is detected. The data of the detected QR code is in `event.detail`.
+- `'code-detected'`: Outgoing Event which is fired if a QR code is detected. The data of the detected QR code is in `event.detail`.
 
 ## Local development
 
diff --git a/packages/qr-code-scanner/src/qr-code-scanner.js b/packages/qr-code-scanner/src/qr-code-scanner.js
index 41cadfb5..dca3ad1b 100644
--- a/packages/qr-code-scanner/src/qr-code-scanner.js
+++ b/packages/qr-code-scanner/src/qr-code-scanner.js
@@ -352,8 +352,8 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
      * @param data
      */
     sendUrl(data) {
-       const event = new CustomEvent("dbp-qr-code-scanner-data",
-            {  bubbles: true, composed: true , detail: data});
+       const event = new CustomEvent("code-detected",
+            {  bubbles: true, composed: true , detail: {'code': data}});
         this.dispatchEvent(event);
     }
 
-- 
GitLab