Change to use Promise API instead of callbacks

This commit is contained in:
Bruce Leidl 2022-11-13 09:16:46 -05:00
parent 9312e89e0c
commit a82307fd95

View File

@ -262,7 +262,7 @@ var RealmSearchProvider = class RealmSearchProvider {
}
}
getResultMetas (ids, callback) {
getResultMetas (ids) {
let metas = [];
for (let id of ids) {
@ -277,7 +277,7 @@ var RealmSearchProvider = class RealmSearchProvider {
}
}
}
callback(metas);
return new Promise(resolve => resolve(metas));
}
activateResult (resultId, _terms) {
@ -300,7 +300,7 @@ var RealmSearchProvider = class RealmSearchProvider {
return results.slice(0, maxNumber)
}
getInitialResultSet(terms, callback, _cancellable) {
getInitialResultSet(terms, _cancellable) {
let realms = this._shellRealms.get_all_realms();
let matches = [];
@ -316,10 +316,10 @@ var RealmSearchProvider = class RealmSearchProvider {
}
}
}
callback(matches);
return new Promise(resolve => resolve(matches));
}
getSubsearchResultSet(previousResults, terms, callback, cancellable) {
this.getInitialResultSet(terms, callback, cancellable)
getSubsearchResultSet(previousResults, terms, cancellable) {
return this.getInitialResultSet(terms, cancellable);
}
}