UNPKG

@alwatr/synapse

Version:

Connect your TypeScript classes to the DOM, declaratively.

35 lines 1.2 kB
import type { DirectiveBase } from './directiveClass.js'; /** * A property decorator that queries the directive's element for a selector. * The query is performed once and the result is cached. * * @param selector The CSS selector to query for. * @param cache Whether to cache the result on first access. Defaults is true. * * @example * ```ts * @directive('[my-directive]') * class MyDirective extends DirectiveBase { * @query('.my-element') * protected myElement?: HTMLDivElement; * } * ``` */ export declare function query(selector: string, cache?: boolean): (target: DirectiveBase, propertyKey: string) => void; /** * A property decorator that queries the directive's element for all selectors. * The queries are performed once and the result is cached. * * @param selector The CSS selector to query for. * * @example * ```ts * @directive('[my-directive]') * class MyDirective extends DirectiveBase { * @queryAll('.my-elements') * protected myElements?: NodeListOf<HTMLDivElement>; * } * ``` */ export declare function queryAll(selector: string, cache?: boolean): (target: DirectiveBase, propertyKey: string) => void; //# sourceMappingURL=queryDecorator.d.ts.map