cache.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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 { Directive, DirectiveParameters, PartInfo } from '../directive.js';
  8. declare class CacheDirective extends Directive {
  9. private _templateCache;
  10. private _value?;
  11. constructor(partInfo: PartInfo);
  12. render(v: unknown): unknown[];
  13. update(containerPart: ChildPart, [v]: DirectiveParameters<this>): unknown[];
  14. }
  15. /**
  16. * Enables fast switching between multiple templates by caching the DOM nodes
  17. * and TemplateInstances produced by the templates.
  18. *
  19. * Example:
  20. *
  21. * ```js
  22. * let checked = false;
  23. *
  24. * html`
  25. * ${cache(checked ? html`input is checked` : html`input is not checked`)}
  26. * `
  27. * ```
  28. */
  29. export declare const cache: (v: unknown) => import("../directive.js").DirectiveResult<typeof CacheDirective>;
  30. /**
  31. * The type of the class that powers this directive. Necessary for naming the
  32. * directive's return type.
  33. */
  34. export type { CacheDirective };
  35. //# sourceMappingURL=cache.d.ts.map