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

lit-directive-subject

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lit-directive-subject

This is a directive of lit-html for update (async mode) parts of your template. Change any part of your template without re-rendering

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Subject part directive of [lit-html]

Export format: ESM Distribution: Npm, Unpackage License: GPL 3.0

This is a directive of lit-html for update (async mode) parts of your template. Change any part of your template without re-rendering.

🔗 See the demo

Installation

Install from NPM or use from Unpkg CDN

Npm

npm install --save lit-directive-subject

Unpkg

import {SubjetPartial} from 'https://unpkg.com/lit-directive-subject?module'

API

SubjetPartial

This is a class for create new partial context for updating in async mode.

Methods:

  • part(): directive for rendering values in you template
  • setValue(value): Set any value for rendering in your template
  • commit(): Commit the current value and force to update template.

Example:

import {render, html} from 'lit-html'
import {SubjectPartial} from 'lit-directive-subject';

const partial = new SubjectPartial();

render(html`
  <h1>Demo</h1>
  <div>
    ${partial.part()}
  </div>
  `, window.container);


// Async updating
(function update() {
  partial.setValue(Math.random())
  partial.commit();
  setTimeout(update, 1000);
})();

Keywords

FAQs

Package last updated on 23 Jan 2021

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