Skip to content
This repository was archived by the owner on Feb 1, 2020. It is now read-only.
/ dom-node-pool Public archive

A simple pool for reusing DOM nodes (to avoid stuttering)

License

tdreyno/dom-node-pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dom-node-pool

A simple pool for reusing DOM nodes (to avoid stuttering).

Usage:

var onClick = function() { alert("Clicked " + this.name); };

var linkPool = new DOMNodePool({
  tagName:     "a",
  initialSize: 10,
  autoInsert:  document.getElementById("my_links"),
  onPop:       function(a) { a.addEventListener("click", onClick); },
  onPush:      function(a) { a.removeEventListener("click", onClick); }
});

var aLink = linkPool.pop();
aLink.name = "Hello";

// User clicks aLink, alert shows "Clicked Hello"

linkPool.push(aLink);

About

A simple pool for reusing DOM nodes (to avoid stuttering)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published