abstract fun onInputChanged(text: String): List<Suggestion>
(source)
Fired whenever the user changes their input, after they have started interacting with the awesome bar.
This is a synchronous call. It is up to the AwesomeBar implementation to perform this operation on a
non-main thread. For example the browser-awesomebar
component wrap this call in an async block inside a
coroutine:
jobs = providers.map { provider ->
launch(UI) {
val suggestions = async(dispatcher) { provider.onInputChanged(text) }
// Do something with suggestions
}
}
This allows the awesome bar component to be in control of the jobs launched and lets it cancel jobs as soon as they are no longer needed. For the provider this makes the implementation easier as it does not need to deal with asynchronous cancellable tasks.
text
- The current user input in the toolbar.
Return
A list of suggestions to be displayed by the AwesomeBar.