Misc

导入

import { defaultConverter } from 'lit';

类型

ComplexAttributeConverter

A boolean that will be true in server environments like Node, and false in browser environments. Note that your server environment or toolchain must support the "node" export condition for this to be true.

导入

import { isServer } from 'lit';

类型

false

详情

This can be used when authoring components to change behavior based on whether or not the component is executing in an SSR context.

Contains types that are part of the unstable debug API.

导入

import { LitUnstable } from 'lit';

详情

Everything in this API is not stable and may change or be removed in the future, even on patch releases.

方法和属性

When Lit is running in dev mode and window.emitLitDebugLogEvents is true, we will emit 'lit-debug' events to window, with live details about the update and render lifecycle. These can be useful for writing debug tooling and visualizations.

详情

Please be aware that running with window.emitLitDebugLogEvents has performance overhead, making certain operations that are normally very cheap (like a no-op render) much slower, because we must copy data and dispatch events.

Change function that returns true if value is different from oldValue. This method is used as the default for a property's hasChanged function.

导入

import { notEqual } from 'lit';

签名

notEqual(value, old): boolean

参数

value
unknown
old
unknown

Contains types that are part of the unstable debug API.

导入

import { ReactiveUnstable } from 'lit';

详情

Everything in this API is not stable and may change or be removed in the future, even on patch releases.

方法和属性

When Lit is running in dev mode and window.emitLitDebugLogEvents is true, we will emit 'lit-debug' events to window, with live details about the update and render lifecycle. These can be useful for writing debug tooling and visualizations.

详情

Please be aware that running with window.emitLitDebugLogEvents has performance overhead, making certain operations that are normally very cheap (like a no-op render) much slower, because we must copy data and dispatch events.

An updateable instance of a Template. Holds references to the Parts used to update the template instance.

导入

import { TemplateInstance } from 'lit';

方法和属性

new TemplateInstance(template, parent): TemplateInstance

永久链接到 constructor
参数
template
Template
parent
ChildPart

Contains types that are part of the unstable debug API.

导入

import { Unstable } from 'lit';

详情

Everything in this API is not stable and may change or be removed in the future, even on patch releases.

方法和属性

When Lit is running in dev mode and window.emitLitDebugLogEvents is true, we will emit 'lit-debug' events to window, with live details about the update and render lifecycle. These can be useful for writing debug tooling and visualizations.

详情

Please be aware that running with window.emitLitDebugLogEvents has performance overhead, making certain operations that are normally very cheap (like a no-op render) much slower, because we must copy data and dispatch events.

导入

import { CompiledTemplate } from 'lit';

导入

import { CompiledTemplateResult } from 'lit';

方法和属性

导入

import { DirectiveParent } from 'lit';

导入

import { Disconnectable } from 'lit';

导入

import { HasChanged } from 'lit';

签名

HasChanged(value, old): boolean

参数

value
unknown
old
unknown

导入

import { HTMLTemplateResult } from 'lit';

类型

TemplateResult<HTML_RESULT>

导入

import { Initializer } from 'lit';

类型

(element: ReactiveElement) => void

Do not use, instead prefer PropertyValues.

导入

import { PropertyValueMap } from 'lit';

方法和属性

参数
k
K

get(k): undefined | T[K]

永久链接到 get 查看源码
参数
k
K
参数
k
K
参数
key
K
value
T[K]

A top-level ChildPart returned from render that manages the connected state of AsyncDirectives created throughout the tree below it.

导入

import { RootPart } from 'lit';

方法和属性

The part's trailing marker node, if any. See .parentNode for more information.

The parent node into which the part renders its content.

详情

A ChildPart's content consists of a range of adjacent child nodes of .parentNode, possibly bordered by 'marker nodes' (.startNode and .endNode).

  • If both .startNode and .endNode are non-null, then the part's content consists of all siblings between .startNode and .endNode, exclusively.
  • If .startNode is non-null but .endNode is null, then the part's content consists of all siblings following .startNode, up to and including the last child of .parentNode. If .endNode is non-null, then .startNode will always be non-null.
  • If both .endNode and .startNode are null, then the part's content consists of all child nodes of .parentNode.

The part's leading marker node, if any. See .parentNode for more information.

setConnected(isConnected): void

永久链接到 setConnected 查看源码

Sets the connection state for AsyncDirectives contained within this root ChildPart.

参数
isConnected
boolean

Whether directives within this tree should be connected or not

详情

lit-html does not automatically monitor the connectedness of DOM rendered; as such, it is the responsibility of the caller to render to ensure that part.setConnected(false) is called before the part object is potentially discarded, to ensure that AsyncDirectives have a chance to dispose of any resources being held. If a RootPart that was previously disconnected is subsequently re-connected (and its AsyncDirectives should re-connect), setConnected(true) should be called.

A function which can sanitize values that will be written to a specific kind of DOM sink.

导入

import { ValueSanitizer } from 'lit';

类型

(value: unknown) => unknown

详情

See SanitizerFactory.

A string representing one of the supported dev mode warning categories.

导入

import { WarningKind } from 'lit';

类型

"change-in-update" | "migration"