Socket
Socket
Sign inDemoInstall

lit-popup

Package Overview
Dependencies
314
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lit-popup

A modern popup module with no dependencies.


Version published
Weekly downloads
82
decreased by-20.39%
Maintainers
1
Install size
25.9 MB
Created
Weekly downloads
 

Readme

Source

LitPopup

A customizable lightweight popup plugin with no dependencies.

Why?

I needed full control over popup animation and its lifecycle.

Installation

NPM

Install it from NPM: npm i lit-popup

Usage

Include css from node_modules/lit-popup/dist/css/lit-popup.min.css (or write your own)

<div class="lit-popup" data-lit-popup="popup">
    <div class="lit-popup-container">
        <!-- Layout here -->
    </div>
</div>
import LitPopup from 'lit-popup';

const popup = new LitPopup('name');

API

Hooks (lifecycle callbacks)

HookParametersDescription
onOpen(instance: LitPopup)Runs before opening animation
onOpenComplete(instance: LitPopup)Runs after opening animation
onClose(instance: LitPopup)Runs before closing animation
onCloseComplete(instance: LitPopup)Runs after closing animation
onDestroy(instance: LitPopup)Runs when 'destroy' method is called
openAnimation(instance: LitPopup)A function describing an opening animation. It must return a promise and resolve when animation is done.
closeAnimation(instance: LitPopup)A function describing a closing animation. It must return a promise and resolve when animation is done.

Events

EventParametersDescription
opennoneTriggers before opening animation
open-completenoneTriggers after opening animation
closenoneTriggers before closing animation
close-completenoneTriggers after closing animation
destroynoneTriggers when 'destroy' method is called

Methods

MethodParametersReturnDescription
opennonePromise<void>Opens the modal
closenonePromise<void>Closes the modal
destroynonevoidDestroys the instance, disposes memory
on(eventName: string, listener: Function)voidAdds an event listener to the popup element
one(eventName: string, listener: Function)voidAdds an event listener to the popup element which will be executed only once
off(eventName: string, listener: Function)voidRemoves an event listener from the popup element which will be executed only once
trigger(eventName: string)voidTriggers an event on the popup element

Accessibility

Work on progress

Keywords

FAQs

Last updated on 21 Sep 2022

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