Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lit-labs/observers

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lit-labs/observers

A set of reactive controllers that facilitate using the platform observer objects.

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@lit-labs/observers

A set of reactive controllers that facilitate using the platform observer objects, including:

  • MutationObserver
  • ResizeObserver
  • IntersectionObserver
  • PerformanceObserver

Overview

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.

Installation

From inside your project folder, run:

$ npm install @lit-labs/observers

Usage

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!` : ``} `;
  }
}

Contributing

Please see CONTRIBUTING.md.

FAQs

Package last updated on 07 Oct 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc