我有一个镀铬扩展名,按钮在点击时不会变暗:
var alreadyClicked = false;
var timer;
chrome.browserAction.onClicked.addListener(function (tab) {
//code for when dobleclicked
timer = setTimeout(function () {
chrome.tabs.update({
url: "http://url.html"
});
clearTimeout(timer);
alreadyClicked = false;
}, 250);
});
翻译扩展程序的按钮示例: