query.d.ts 998 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * @license
  3. * Copyright 2017 Google LLC
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. import { ReactiveElement } from '../reactive-element.js';
  7. /**
  8. * A property decorator that converts a class property into a getter that
  9. * executes a querySelector on the element's renderRoot.
  10. *
  11. * @param selector A DOMString containing one or more selectors to match.
  12. * @param cache An optional boolean which when true performs the DOM query only
  13. * once and caches the result.
  14. *
  15. * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
  16. *
  17. * ```ts
  18. * class MyElement {
  19. * @query('#first')
  20. * first;
  21. *
  22. * render() {
  23. * return html`
  24. * <div id="first"></div>
  25. * <div id="second"></div>
  26. * `;
  27. * }
  28. * }
  29. * ```
  30. * @category Decorator
  31. */
  32. export declare function query(selector: string, cache?: boolean): (protoOrDescriptor: ReactiveElement | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any;
  33. //# sourceMappingURL=query.d.ts.map