Merge slick carousel

This commit is contained in:
Pieter Vander Vennet 2021-02-05 19:11:19 +01:00
commit b9d5a85cd0
18 changed files with 174 additions and 196 deletions

View file

@ -17,17 +17,17 @@ import {UIEventSource} from "../UIEventSource";
* Note that this list is embedded into an UIEVentSource, ready to put it into a carousel.
*
*/
export class ImageSearcher {
export class ImageSearcher extends UIEventSource<{ key: string, url: string }[]>{
public readonly images = new UIEventSource<{ key: string, url: string }[]>([]);
private readonly _wdItem = new UIEventSource<string>("");
private readonly _commons = new UIEventSource<string>("");
constructor(tags: UIEventSource<any>, imagePrefix = "image", loadSpecial = true) {
super([])
const self = this;
function AddImages(images: { key: string, url: string }[]) {
const oldUrls = self.images.data.map(kurl => kurl.url);
const oldUrls = self.data.map(kurl => kurl.url);
let somethingChanged = false;
for (const image of images) {
const url = image.url;
@ -41,11 +41,11 @@ export class ImageSearcher {
continue;
}
self.images.data.push(image);
self.data.push(image);
somethingChanged = true;
}
if (somethingChanged) {
self.images.ping();
self.ping();
}
}