timestamp-witch-js
v1.0.0
Published
Advanced library for managing HTML elements based on timestamps with timezone support
Maintainers
Readme
TimestampWitchJs
Advanced library for managing HTML elements based on timestamps with timezone support.
Features
- Remove elements based on expiry timestamps with flexible format support
- Pre-scheduling of removals for efficiency
- Multiple timezone support (UTC, local, or specific timezones)
- JavaScript and HTTP callbacks on element removal
- Lazy loading with IntersectionObserver
- Worker thread processing for performance
- Intelligent rescanning with MutationObserver
- Local storage caching for persistence
- Debug mode for development
- Batched DOM updates for smooth UI
- Throttled removals
Installation
npm install timestamp-witch-jsBasic Usage
// Initialize with default settings
const witch = new TimestampWitchJs().init();
// Add expiry to an element
witch.addExpiryToElement(document.querySelector('.my-element'), '2025-04-04 09:30:00 UTC');HTML Markup
<div class="match-card"
data-tc-expiry="2025-04-04 09:30:00"
data-tc-timezone="America/New_York"
data-tc-callbackFunction="updateCounter">
Time-sensitive content
</div>Advanced Configuration
See the full documentation for details on all configuration options and features.
Credits
Original idea by Saulius Morkevicius
Generated with the assistance of Claude 3.7 Sonnet
License
MIT
