async-append.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @license
  3. * Copyright 2017 Google LLC
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. import { ChildPart } from '../lit-html.js';
  7. import { DirectiveParameters, PartInfo } from '../directive.js';
  8. import { AsyncReplaceDirective } from './async-replace.js';
  9. declare class AsyncAppendDirective extends AsyncReplaceDirective {
  10. private __childPart;
  11. constructor(partInfo: PartInfo);
  12. update(part: ChildPart, params: DirectiveParameters<this>): typeof import("../lit-html.js").noChange | undefined;
  13. protected commitValue(value: unknown, index: number): void;
  14. }
  15. /**
  16. * A directive that renders the items of an async iterable[1], appending new
  17. * values after previous values, similar to the built-in support for iterables.
  18. * This directive is usable only in child expressions.
  19. *
  20. * Async iterables are objects with a [Symbol.asyncIterator] method, which
  21. * returns an iterator who's `next()` method returns a Promise. When a new
  22. * value is available, the Promise resolves and the value is appended to the
  23. * Part controlled by the directive. If another value other than this
  24. * directive has been set on the Part, the iterable will no longer be listened
  25. * to and new values won't be written to the Part.
  26. *
  27. * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
  28. *
  29. * @param value An async iterable
  30. * @param mapper An optional function that maps from (value, index) to another
  31. * value. Useful for generating templates for each item in the iterable.
  32. */
  33. export declare const asyncAppend: (value: AsyncIterable<unknown>, _mapper?: ((v: unknown, index?: number | undefined) => unknown) | undefined) => import("../directive.js").DirectiveResult<typeof AsyncAppendDirective>;
  34. /**
  35. * The type of the class that powers this directive. Necessary for naming the
  36. * directive's return type.
  37. */
  38. export type { AsyncAppendDirective };
  39. //# sourceMappingURL=async-append.d.ts.map