Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@lit-labs/observers
Advanced tools
A set of reactive controllers that facilitate using the platform observer objects.
A set of reactive controllers that facilitate using the platform observer objects, including:
The modern web platform provides a number of observer helpers that can be used to detect changes to which web applications may want to react. By managing one of these observers with a reactive controller, changes can be easily integrated into the Lit reactive update lifecycle. The controller can also help manage observer cleanup and rendering in response to changes.
From inside your project folder, run:
$ npm install @lit-labs/observers
Here's an example:
import {MutationController} from '@lit-labs/observers/mutation_controller.js';
// ...
class MyElement extends LitElement {
private _observer = new MutationController(this, {
config: {attributes: true},
});
render() {
return html` ${this._observer.value ? `Attributes set!` : ``} `;
}
}
Please see CONTRIBUTING.md.
@lit/reactive-element
- 1.0.0
@lit/reactive-element
is a new package that factors out the base class that provides the reactive update lifecycle based on property/attribute changes to LitElement
(what was previously called UpdatingElement
) into a separate package. LitElement
now extends ReactiveElement
to add lit-html
rendering via the render()
callback. See ReactiveElement API for more details.UpdatingElement
has been renamed to ReactiveElement
.updating-element
package has been renamed to @lit/reactive-element
.@internalProperty
decorator has been renamed to @state
._getUpdateComplete
to getUpdateComplete
.reflect: true
and its toAttribute
function returns undefined
the attribute is now removed where previously it was left unchanged (#872).unhandledrejection
event handler on window.renderRoot
is now created when the element's connectedCallback
is initially run.requestUpdateInternal
. The requestUpdate
method is now identical to this method and should be used instead.initialize
method has been removed. This work is now done in the element constructor.static addInitializer
for adding a function which is called with the element instance when is created. This can be used, for example, to create decorators which hook into element lifecycle by creating a reactive controller (#1663).connectedCallback
, disconnectedCallback
, willUpdate
, update
, and updated
. To ensure it has access to the element lifecycle, a controller should be added in the element's constructor. To add a controller to the element, call addController(controller)
.removeController(controller)
which can be used to remove a controller from a ReactiveElement
.willUpdate(changedProperties)
lifecycle method to UpdatingElement. This is called before the update
method and can be used to compute derived state needed for updating. This method is intended to be called during server side rendering and should not manipulate element DOM.FAQs
A set of reactive controllers that facilitate using the platform observer objects.
The npm package @lit-labs/observers receives a total of 34,628 weekly downloads. As such, @lit-labs/observers popularity was classified as popular.
We found that @lit-labs/observers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.