Skip to content

Commit

Permalink
Missing documentation added to the source code
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-taran committed Feb 7, 2023
1 parent d9b931b commit 981c493
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
9 changes: 9 additions & 0 deletions autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ export interface AutocompleteItem {
group?: string;
}
export interface AutocompleteEvent<T extends Event> {
/**
* Native event object passed by browser to the event handler
*/
event: T;
/**
* Fetch data and display autocomplete
*/
fetch: () => void;
}
export interface AutocompleteSettings<T extends AutocompleteItem> {
Expand Down Expand Up @@ -91,6 +97,9 @@ export interface AutocompleteSettings<T extends AutocompleteItem> {
click?: (e: AutocompleteEvent<MouseEvent>) => void;
}
export interface AutocompleteResult {
/**
* Remove event handlers, DOM elements and ARIA/accessibility attributes created by the widget.
*/
destroy: () => void;
}
export default function autocomplete<T extends AutocompleteItem>(settings: AutocompleteSettings<T>): AutocompleteResult;
2 changes: 1 addition & 1 deletion autocomplete.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion autocomplete.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion autocomplete.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion autocomplete.min.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ export interface AutocompleteItem {
}

export interface AutocompleteEvent<T extends Event> {
/**
* Native event object passed by browser to the event handler
*/
event: T;
/**
* Fetch data and display autocomplete
*/
fetch: () => void;
}

Expand Down Expand Up @@ -116,6 +122,9 @@ export interface AutocompleteSettings<T extends AutocompleteItem> {
}

export interface AutocompleteResult {
/**
* Remove event handlers, DOM elements and ARIA/accessibility attributes created by the widget.
*/
destroy: () => void;
}

Expand Down Expand Up @@ -305,7 +314,7 @@ export default function autocomplete<T extends AutocompleteItem>(settings: Autoc
}

const fragment = doc.createDocumentFragment();
let prevGroup = "#9?$";
let prevGroup = uid();

items.forEach(function (item: T, index: number): void {
if (item.group && item.group !== prevGroup) {
Expand Down

0 comments on commit 981c493

Please sign in to comment.