fileUtils: Refactor collectFromDatadirs to be a generator

This change enables mapping each collected file to a Promise in
asynchronous operations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2364>
This commit is contained in:
Evan Welsh
2022-11-29 20:17:20 -06:00
committed by Marge Bot
parent 577d1ecf41
commit b7c097ba79
4 changed files with 40 additions and 16 deletions

View File

@ -139,7 +139,8 @@ function loadRemoteSearchProviders(searchSettings) {
if (searchSettings.get_boolean('disable-external'))
return [];
FileUtils.collectFromDatadirs('search-providers', false, loadRemoteSearchProvider);
for (const {dir} of FileUtils.collectFromDatadirs('search-providers', false))
loadRemoteSearchProvider(dir);
let sortOrder = searchSettings.get_strv('sort-order');