From 30ce81b36cacfbab173098b9eceb85ccf9c9870f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 16 Jan 2021 21:53:52 -0500 Subject: Update TextScanner.search to return the event details object (#1257) --- ext/mixed/js/text-scanner.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ext/mixed') diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js index 98d87341..411b1b20 100644 --- a/ext/mixed/js/text-scanner.js +++ b/ext/mixed/js/text-scanner.js @@ -309,7 +309,7 @@ class TextScanner extends EventDispatcher { try { if (this._textSourceCurrent !== null && this._textSourceCurrent.hasSameStart(textSource)) { - return; + return null; } ({optionsContext, detail} = await this._getSearchContext()); @@ -327,9 +327,9 @@ class TextScanner extends EventDispatcher { error = e; } - if (!searched) { return; } + if (!searched) { return null; } - this.trigger('searched', { + const results = { textScanner: this, type, definitions, @@ -339,7 +339,9 @@ class TextScanner extends EventDispatcher { optionsContext, detail, error - }); + }; + this.trigger('searched', results); + return results; } _onMouseOver(e) { -- cgit v1.2.3