I want the popup.html to open when I click on the extension, however when I double click on it, I want another function to run. I already have the code (see below) that determines whether or not it's single/double click.
var alreadyClicked = false;
var timer;
chrome.browserAction.onClicked.addListener(function (tab) {
if (alreadyClicked) {
clearTimeout(timer);
console.log("Double click");
alreadyClicked = false;
return;
}
//Set Click to true
alreadyClicked = true;
//Add a timer to detect next click to a sample of 250
timer = setTimeout(function () {
//No more clicks so, this is a single click
console.log("Single click");
//Clear all timers
clearTimeout(timer);
//Ignore clicks
alreadyClicked = false;
}, 250);
});