until.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @license
  3. * Copyright 2017 Google LLC
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. import { Part } from '../lit-html.js';
  7. import { AsyncDirective } from '../async-directive.js';
  8. export declare class UntilDirective extends AsyncDirective {
  9. private __lastRenderedIndex;
  10. private __values;
  11. private __weakThis;
  12. private __pauser;
  13. render(...args: Array<unknown>): unknown;
  14. update(_part: Part, args: Array<unknown>): unknown;
  15. disconnected(): void;
  16. reconnected(): void;
  17. }
  18. /**
  19. * Renders one of a series of values, including Promises, to a Part.
  20. *
  21. * Values are rendered in priority order, with the first argument having the
  22. * highest priority and the last argument having the lowest priority. If a
  23. * value is a Promise, low-priority values will be rendered until it resolves.
  24. *
  25. * The priority of values can be used to create placeholder content for async
  26. * data. For example, a Promise with pending content can be the first,
  27. * highest-priority, argument, and a non_promise loading indicator template can
  28. * be used as the second, lower-priority, argument. The loading indicator will
  29. * render immediately, and the primary content will render when the Promise
  30. * resolves.
  31. *
  32. * Example:
  33. *
  34. * ```js
  35. * const content = fetch('./content.txt').then(r => r.text());
  36. * html`${until(content, html`<span>Loading...</span>`)}`
  37. * ```
  38. */
  39. export declare const until: (...values: unknown[]) => import("../directive.js").DirectiveResult<typeof UntilDirective>;
  40. /**
  41. * The type of the class that powers this directive. Necessary for naming the
  42. * directive's return type.
  43. */
  44. //# sourceMappingURL=until.d.ts.map