开发者

Get keyboard modifier when user click in toolbar command of safari extension

I want to get keyboard modifiers (like shift or option keys) when user click by toobar command of my safari extension.

In global HTML page I have next code:

safari.application.addEventListener("command", performCommand, false);

function performCommand(event)
{
    if (event.command === "foo") {

          //TODO: is shift pressed?
    }
}

Is it possible? O开发者_开发问答r may be exists any workaround?


Unfortunately, keyCode is not currently available on the command and validate events for toolbar items. I submit enhancement request to apple.


In Safari, you should be able to do:

if (event.shiftKey) {
  // Shift key was pressed...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜