Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.
/ once Public archive
forked from KayLeung/dropletOnce

Only process DOM elements once

License

Notifications You must be signed in to change notification settings

theodoreb/once

 
 

Repository files navigation

DEPRECATED

Developement moved back to Drupal.org, please see https://www.drupal.org/project/once.

once-dom

Select and filter DOM elements to process them only once.

Documentation and examples

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.

Contributors

These amazing people have contributed code to this project:

About

Only process DOM elements once

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages

  • JavaScript 98.9%
  • HTML 1.1%