Skip to content

Commit

Permalink
Add clear event TarekRaafat#411
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-rudzinski committed Oct 16, 2024
1 parent 60329e5 commit 7e10ff3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -706,3 +706,18 @@ document.querySelector("#autoComplete").addEventListener("close", function (even
console.log(event.detail);
});
```

***

### clear

> Fires after "resultsList" is cleared
##### Example:

```js
document.querySelector("#autoComplete").addEventListener("clear", function (event) {
// "event.detail" carries the autoComplete.js "feedback" object
console.log(event.detail);
});
```
5 changes: 5 additions & 0 deletions src/controllers/listController.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ const navigate = (event, ctx) => {
// Clear "input" value
ctx.input.value = "";

/**
* @emit {clear} event on input clear
**/
eventEmitter('clear', ctx);

close(ctx);
break;
}
Expand Down

0 comments on commit 7e10ff3

Please sign in to comment.