UNPKG

@uploadcare/file-uploader

Version:

Building blocks for Uploadcare products integration

127 lines 3.26 kB
export class TypedCollection { /** * @param {Object} options * @param {Object<string, { type: any; value: any }>} options.typedSchema * @param {String[]} [options.watchList] * @param {(list: string[], added: Set<any>, removed: Set<any>) => void} [options.handler] * @param {String} [options.ctxName] */ constructor(options: { typedSchema: { [x: string]: { type: any; value: any; }; }; watchList?: string[] | undefined; handler?: ((list: string[], added: Set<any>, removed: Set<any>) => void) | undefined; ctxName?: string | undefined; }); /** * @private * @type {Object<string, { type: any; value: any }>} */ private __typedSchema; /** * @private * @type {String} */ private __ctxId; /** * @private * @type {Data} */ private __data; /** * @private * @type {string[]} */ private __watchList; /** * @private * @type {Object<string, any>} */ private __subsMap; /** * @private * @type {Set<Function>} */ private __propertyObservers; /** * @private * @type {Set<(list: string[], added: Set<any>, removed: Set<any>) => void>} */ private __collectionObservers; /** * @private * @type {Set<string>} */ private __items; /** * @private * @type {Set<any>} */ private __removed; /** * @private * @type {Set<any>} */ private __added; /** * @private * @param {String} propName * @param {String} ctxId */ private __notifyObservers; /** @private */ private __observeTimeout; notify(): void; /** @private */ private __notifyTimeout; /** @param {(list: string[], added: Set<any>, removed: Set<any>) => void} handler */ observeCollection(handler: (list: string[], added: Set<any>, removed: Set<any>) => void): () => void; /** @param {Function} handler */ unobserveCollection(handler: Function): void; /** * @param {Object<string, any>} init * @returns {string} */ add(init: { [x: string]: any; }): string; /** * @param {String} id * @returns {TypedData} */ read(id: string): TypedData; /** * @param {String} id * @param {String} propName * @returns {any} */ readProp(id: string, propName: string): any; /** * @template T * @param {String} id * @param {String} propName * @param {T} value */ publishProp<T>(id: string, propName: string, value: T): void; /** @param {String} id */ remove(id: string): void; clearAll(): void; /** @param {Function} handler */ observeProperties(handler: Function): () => void; /** @param {Function} handler */ unobserveProperties(handler: Function): void; /** * @param {(item: TypedData) => Boolean} checkFn * @returns {String[]} */ findItems(checkFn: (item: TypedData) => boolean): string[]; items(): string[]; get size(): number; destroy(): void; } import { TypedData } from './TypedData.js'; //# sourceMappingURL=TypedCollection.d.ts.map