export interface Token { attributeName: string; content: string; element: T; } export interface TokenListWatcherDelegate { tokenMatched?: (token: Token) => void; tokenUnmatched?: (token: Token) => void; } /** * Watches the document for elements with `[attributeName]` and emits a `tokenMatched` callback for each whitespace- * separated token in the attribute value. Token additions and removals (via attribute changes) are diffed and emitted * incrementally. * * A delegate that throws for one token is reported like an uncaught error; the remaining tokens on that element are * still tracked and reported. * * Only elements contained within `scope` (or the `scope` element itself) are tracked. The returned `stop` function * synchronously fires `tokenUnmatched` for every currently-tracked token before deregistering. Every token is reported * and the watcher is deregistered even if the delegate throws; the first error is rethrown afterwards. Once `stop` has * run, nothing more is tracked or reported, even when a delegate calls it part-way through an element's tokens. */ export declare function watchTokenList(scope: Element, attributeName: string, delegate: TokenListWatcherDelegate): () => void; /** The whitespace-separated tokens `element` lists in `attributeName`, in order and duplicates included. */ export declare function listedContents(element: Element, attributeName: string): string[]; //# sourceMappingURL=token_list_watcher.d.ts.map