I need to detect a double click on the button of my extension and open a different website and I need that website to be opened in the current tab.
index.js:
var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");
var button = buttons.ActionButton({
id: "mozilla-link",
label: "Visit Mozilla",
icon: {
"16": "./icon-16.png",
"32": "./icon-32.png",
"64": "./icon-64.png"
},
onClick: handleClick
});
function handleClick(state) {
tabs.open("http://www.mozilla.org/");
}
I have a similar requirement in one of my extensions. Here's the code I use to determine if the button click is a single or a double: