Update TextScanner.search to return the event details object (#1257)

This commit is contained in:
toasted-nutbread 2021-01-16 21:53:52 -05:00 committed by GitHub
parent 0cbbe48694
commit 30ce81b36c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,7 +309,7 @@ class TextScanner extends EventDispatcher {
try { try {
if (this._textSourceCurrent !== null && this._textSourceCurrent.hasSameStart(textSource)) { if (this._textSourceCurrent !== null && this._textSourceCurrent.hasSameStart(textSource)) {
return; return null;
} }
({optionsContext, detail} = await this._getSearchContext()); ({optionsContext, detail} = await this._getSearchContext());
@ -327,9 +327,9 @@ class TextScanner extends EventDispatcher {
error = e; error = e;
} }
if (!searched) { return; } if (!searched) { return null; }
this.trigger('searched', { const results = {
textScanner: this, textScanner: this,
type, type,
definitions, definitions,
@ -339,7 +339,9 @@ class TextScanner extends EventDispatcher {
optionsContext, optionsContext,
detail, detail,
error error
}); };
this.trigger('searched', results);
return results;
} }
_onMouseOver(e) { _onMouseOver(e) {