UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

118 lines 2.76 kB
/** * @template T */ export class CacheKey<T> { /** * @template T * @param {T} thing */ constructor(thing: T_1); /** * * @type {T} */ thing: T_1; /** * @type {number} */ __hash: number; /** * * @return {number} */ hash(): number; /** * * @param {T} other * @return {boolean} */ equals(other: T): boolean; } export class ListView extends View<HTMLElement> { /** * List representation * @template E * @param {List<E>|E[]} model List to be represented * @param {string[]} [classList] collection of CSS classes * @param {function(E):View} elementFactory factory function, takes a list element and returns a view * @param {function(E, View, number, ListView<E>)} [addHook] hook function to be called when a view is created * @param {function(E, View, number, ListView<E>)} [removeHook] hook function to be called when a view is created * @param {function(E):boolean} [filter] * @param {number} [cacheSize] * @param {boolean} [useCache] * @constructor */ constructor(model: List<E> | E[], { classList, elementFactory, addHook, removeHook, filter, cacheSize, useCache }?: string[]); /** * @private * @type {Cache<E, View>} */ private __cache; /** * * @type {boolean} * @private */ private __useCache; /** * * @type {List<E>} */ model: List<E>; elementFactory: any; filter: { <S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; }; hooks: { add: any; remove: any; }; el: HTMLDivElement; /** * * @type {Map<E, View>} */ viewMapping: Map<E, View<HTMLElement>>; /** * * @param {E} el * @returns {View} */ acquireView(el: E): View; /** * @private * @param el * @param index */ private insertOne; /** * @private * @param {E} el * @param {number} index * @returns {View} */ private addOne; /** * @private * @param {E} el * @param {number} index */ private removeOne; /** * * @param {E} el * @returns {number} -1 if not found */ getChildIndexByElement(el: E): number; /** * * @param {E} el * @returns {View|null} */ getChildByElement(el: E): View | null; } export default ListView; import View from "../View.js"; import List from "../../core/collection/list/List.js"; //# sourceMappingURL=ListView.d.ts.map