UNPKG

1.27 kBTypeScriptView Raw
1import { Binding, BindingTag } from './binding';
2import { Context } from './context';
3import { BoundValue } from './value-promise';
4/**
5 * Indexer for context bindings by tag
6 */
7export declare class ContextTagIndexer {
8 protected readonly context: Context;
9 /**
10 * Index for bindings by tag names
11 */
12 readonly bindingsIndexedByTag: Map<string, Set<Readonly<Binding<unknown>>>>;
13 /**
14 * A listener for binding events
15 */
16 private bindingEventListener;
17 /**
18 * A listener to maintain tag index for bindings
19 */
20 private tagIndexListener;
21 constructor(context: Context);
22 /**
23 * Set up context/binding listeners and refresh index for bindings by tag
24 */
25 private setupTagIndexForBindings;
26 /**
27 * Remove tag index for the given binding
28 * @param binding - Binding object
29 */
30 private removeTagIndexForBinding;
31 /**
32 * Update tag index for the given binding
33 * @param binding - Binding object
34 */
35 private updateTagIndexForBinding;
36 /**
37 * Find bindings by tag leveraging indexes
38 * @param tag - Tag name pattern or name/value pairs
39 */
40 findByTagIndex<ValueType = BoundValue>(tag: BindingTag | RegExp): Readonly<Binding<ValueType>>[];
41 close(): void;
42}