Select the proper turbo list

This commit is contained in:
Nils Maier 2019-08-25 20:53:20 +02:00
parent 26cd8e8a00
commit 176060183e
2 changed files with 9 additions and 5 deletions

View File

@ -91,10 +91,14 @@ export const API = new class {
if (!this.sanity(links, media)) {
return false;
}
const selected = makeUniqueItems([
await API.filter(links, TYPE_LINK),
await API.filter(media, TYPE_MEDIA),
]);
const type = await Prefs.get("last-type", "links");
const items = await (async () => {
if (type === "links") {
return await API.filter(links, TYPE_LINK);
}
return await API.filter(media, TYPE_MEDIA);
})();
const selected = makeUniqueItems([items]);
if (!selected.length) {
return await this.regular(links, media);
}

View File

@ -99,7 +99,7 @@ function transfer(e: any, other: any) {
}
export function makeUniqueItems(items: any, mapping?: Function) {
export function makeUniqueItems(items: any[][], mapping?: Function) {
const known = new Map();
const unique = [];
for (const itemlist of items) {