Hmm. This did not work. The single click event still happens on a double-click.
What I needed to do was set the timer to null immediately after clearing it:
function dblclickNode(d, i) {
clearTimeout(dblclickTimer);
dblclickTimer = null;
...
}
In the "real" click function foo(), I check if the timer is null:
function foo(node, d, i) {
if (dblclickTimer === null)
return;
var id = d3.select(node).attr("id"); ...}
Pretty complicated, but it seems to now work. Thanks for getting me started.
-Alex