Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rantler/521324 to your computer and use it in GitHub Desktop.
Save rantler/521324 to your computer and use it in GitHub Desktop.
// Counting Event observers with Prototype 1.6
javascript:alert(
"Event Observers\n" + $H(Event.cache).inject( $H(),
function (acc, p) {
$H(p.value).each(
function (evtT) {
if ( !acc.get(evtT.key) )
acc.set(evtT.key, 0);
acc.set(evtT.key,
acc.get(evtT.key) + evtT.value.size()
);
}
);
return acc;
}
).inject( "",
function (acc,p) {
acc += "\n"
+ p.key
+ ":"
+ "\t"
+ p.value;
return acc;
}
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment