mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Annotate return values
This commit is contained in:
parent
1fe752dca3
commit
18c72814a9
1 changed files with 4 additions and 6 deletions
|
@ -107,14 +107,14 @@ export class SuggestionsPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
selectNext() {
|
selectNext() {
|
||||||
return this.changeSelection(1);
|
this.changeSelection(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectPrevious() {
|
selectPrevious() {
|
||||||
return this.changeSelection(-1);
|
this.changeSelection(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
showForField(targetElement: HTMLElement): SuggestionsPopup {
|
showForField(targetElement: HTMLElement) {
|
||||||
this.container.style.position = 'absolute';
|
this.container.style.position = 'absolute';
|
||||||
this.container.style.left = `${targetElement.offsetLeft}px`;
|
this.container.style.left = `${targetElement.offsetLeft}px`;
|
||||||
|
|
||||||
|
@ -127,8 +127,6 @@ export class SuggestionsPopup {
|
||||||
this.container.style.top = `${topPosition}px`;
|
this.container.style.top = `${topPosition}px`;
|
||||||
|
|
||||||
document.body.appendChild(this.container);
|
document.body.appendChild(this.container);
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemSelected(callback: (event: CustomEvent<TermSuggestion>) => void) {
|
onItemSelected(callback: (event: CustomEvent<TermSuggestion>) => void) {
|
||||||
|
@ -138,7 +136,7 @@ export class SuggestionsPopup {
|
||||||
|
|
||||||
const cachedSuggestions = new Map<string, Promise<TermSuggestion[]>>();
|
const cachedSuggestions = new Map<string, Promise<TermSuggestion[]>>();
|
||||||
|
|
||||||
export async function fetchSuggestions(endpoint: string, targetTerm: string) {
|
export async function fetchSuggestions(endpoint: string, targetTerm: string): Promise<TermSuggestion[]> {
|
||||||
const normalizedTerm = targetTerm.trim().toLowerCase();
|
const normalizedTerm = targetTerm.trim().toLowerCase();
|
||||||
|
|
||||||
if (cachedSuggestions.has(normalizedTerm)) {
|
if (cachedSuggestions.has(normalizedTerm)) {
|
||||||
|
|
Loading…
Reference in a new issue