expireat

expireAt is a plugin that helps you track html elements, that have to expire on a specific time.

Usage no npm install needed!

<script type="module">
  import expireat from 'https://cdn.skypack.dev/expireat';
</script>

README

jQuery expireAt

About

The plugins purpose is to help you indicate once an html element has to expire. Once an expire date has been reached, a class will be added expireAt-expired to the element. As well as a callback function will be executed.

Usage

  1. Include jQuery:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    
  2. Include plugin's code:

    <script src="jquery.expireAt.min.js"></script>
    
  3. Add the data-expire-at attribute with the expiration date to the elements you want to expire:

    <tr class="element" data-expire-at='2015-03-06 14:09:09'></tr>
    
  4. Call the plugin:

    $(".element").expireAt({
        interval: 60000, // Set an custom interval you want the plugin to iterate through the elements. The default is 60 seconds
        callback: function(element){
            console.warn('Expired:', element); // You can use this callback function to handle the expired element
        }
    });
    

demo/

Contains a simple HTML file to demonstrate the plugin.

src/

This is where the source code is stored.