event-options.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. * Adds event listener options to a method used as an event listener in a
  9. * lit-html template.
  10. *
  11. * @param options An object that specifies event listener options as accepted by
  12. * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.
  13. *
  14. * Current browsers support the `capture`, `passive`, and `once` options. See:
  15. * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
  16. *
  17. * ```ts
  18. * class MyElement {
  19. * clicked = false;
  20. *
  21. * render() {
  22. * return html`
  23. * <div @click=${this._onClick}>
  24. * <button></button>
  25. * </div>
  26. * `;
  27. * }
  28. *
  29. * @eventOptions({capture: true})
  30. * _onClick(e) {
  31. * this.clicked = true;
  32. * }
  33. * }
  34. * ```
  35. * @category Decorator
  36. */
  37. export declare function eventOptions(options: AddEventListenerOptions): (protoOrDescriptor: ReactiveElement | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any;
  38. //# sourceMappingURL=event-options.d.ts.map