Socket
Socket
Sign inDemoInstall

lit-directive-subject

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

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


Version published
Weekly downloads
3
Maintainers
1
Install size
37.8 kB
Created
Weekly downloads
 

Readme

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

Last updated on 23 Jan 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc