From f7b6482899f3d2f232fd5e740b6b3b4c6257bb52 Mon Sep 17 00:00:00 2001 From: Hugo Gresse Date: Wed, 6 Jul 2022 11:19:17 +0200 Subject: [PATCH] Send identification event to DOM + track for carpeso (#33) * send identification event to DOM + track for carpeso * Fix lint --- index.html | 4 ++++ indexCarperso.html | 12 ++++++++++++ src/AiTaxonomist.ts | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/index.html b/index.html index 4d42a20..984492a 100644 --- a/index.html +++ b/index.html @@ -37,6 +37,10 @@ // eslint-disable-next-line no-alert alert(`Attachments clicked: ${e.detail.taxonName}`) }) + document.addEventListener('aiTaxonomistNewIdentification', () => { + // eslint-disable-next-line no-console + console.log("New identification") + }) const apiUrl = 'http://localhost:3000/v2/identify/all' render( diff --git a/indexCarperso.html b/indexCarperso.html index 38bcde6..ca36dc5 100644 --- a/indexCarperso.html +++ b/indexCarperso.html @@ -61,11 +61,13 @@ @@ -81,6 +83,16 @@ WebComponent repository +
Chargement...
diff --git a/src/AiTaxonomist.ts b/src/AiTaxonomist.ts index 7a4e457..513770b 100644 --- a/src/AiTaxonomist.ts +++ b/src/AiTaxonomist.ts @@ -166,6 +166,14 @@ export class AiTaxonomist extends LitElement { this.identify.error = null this.identify.state = IdentifyState.Loading + this.dispatchEvent( + new CustomEvent('aiTaxonomistNewIdentification', { + bubbles: true, + composed: true, + cancelable: true, + }) + ) + const response = await identifyRequest(this.imageFiles, this.apiUrl, this.apiKey, this.backendFormat) if (typeof response === 'string') {