Developement moved back to Drupal.org, please see https://www.drupal.org/project/once.
Select and filter DOM elements to process them only once.
Example (Use as a module)
<script type="module">
import once from 'https://unpkg.com/once-dom@latest/dist/once.esm.js';
const elements = once('my-once-id', 'div');
// Initialize elements.
elements.forEach(el => el.innerHTML = 'processed');
</script>
Example (Use as a regular script)
<script src="https://unpkg.com/once-dom@latest/dist/once.min.js"></script>
<script>
const elements = once('my-once-id', 'div');
// Initialize elements.
elements.forEach(el => el.innerHTML = 'processed');
</script>
Full API documentation and examples in the API docs.
These amazing people have contributed code to this project: