Hatena::Groupkeysnail

hogelogの日記

 | 

2010-03-04

hook-menu-popup.ks.js 0.0.2

13:01

以下のフックポイントをKeySnailに追加するプラグインを書きました。

  • MenuPopupShowing
  • MenuPopupHiding
  • MainMenuPopupShowing
  • MainMenuPopupHiding
  • ContextMenuPopupShowing
  • ContextMenuPopupHiding

http://github.com/hogelog/keysnail-plugins/blob/master/hook-menu-popup.ks.js

MainMenuPopupはメニューバーのメニュー、ContextMenuPopupは右クリックメニューへのフックです。これらのフックは他のフックポイントなどと同様にhook.setHook、hook.addToHookなどから利用できます。


私は以下のようにメニュー表示時はkeysnailを一時的に停止するために使っています。

function stopKeySnail (ev) {
    key.suspended = true;
}
function restartKeySnail (ev) {
    key.suspended = false;
}
hook.setHook('MenuPopupShowing', stopKeySnail);
hook.setHook('MenuPopupHiding', restartKeySnail);

というかこのために作ったのですけども。

余談: addEventListenerに渡す関数

EventTarget.addEventListener - Web API インターフェイス | MDN

オブジェクトプロパティを渡すとthisがaddEventListenerを実行した時のそれになる。のでそれを回避しようと無名関数にくるんで渡すと無名関数アクセスできる変数全てを保持しておく必要があるからメモリ使用量が増大する、という意味だろうか。

とりあえず普通の関数にしておいてついでにremoveEventListenerしておくようにすれば問題ないのだろうけど。いまいち意味がわからない。EventListenerに起因する不具合はよく聞くような気がするのでこの辺の仕様を把握しておきたい。

MelloneyMelloney2011/12/11 09:55A million tnhkas for posting this information.

lhmaugmxzlhmaugmxz2011/12/11 17:10t8E2CF <a href="http://yilgumouqdmp.com/">yilgumouqdmp</a>

usunzewusunzew2011/12/11 21:47zdYsSS , [url=http://vvhduahiatpd.com/]vvhduahiatpd[/url], [link=http://epqzipsjsfsw.com/]epqzipsjsfsw[/link], http://rcgxzuglojau.com/

oecmnhctmnoecmnhctmn2011/12/13 19:53tG0JYV <a href="http://ojuwsagygqvx.com/">ojuwsagygqvx</a>

mrfjtotyamrfjtotya2011/12/14 00:12InBLii , [url=http://jxurzdlywjzd.com/]jxurzdlywjzd[/url], [link=http://llvcgponxaip.com/]llvcgponxaip[/link], http://yadzkfalnpgd.com/

AGeomCootaleAGeomCootale2018/02/03 12:15 Four to five portions of this fruit juice has to be consumed every week to get the desired result. Use these circumspectly however, while they may lower blood sugar levels, that is an undesirable effect that face men whose blood glucose levels are properly balanced.
https://www.cialissansordonnancefr24.com/cialis-ou-produit-naturel/

JamisonfoedyJamisonfoedy2018/02/09 12:09Shops that require protection for high risk goods held on the premises will usually need to declare the total values of each stock item. High risk shop stock and goods are those that attract thieves and are expensive to replace. Examples of high risk stock items are electronic equipment, cigarettes, and tobacco, designer clothing, computers and digital equipment, software, computer games and consoles, drugs pharmacy and medicines, watches and jewellery, mobile phones and radios, photographic equipment, power tools, TVs, DVDs, CDs and Wines and Spirits.

If your shop has high risk stock you can reduce the cost of your premiums by having adequate security in place. This includes an insurance company approved burglar and fire alarm, window grills, shutters and bars, CCTV and sprinklers. Many shop insurers will only offer stock cover if the minimum levels of security are in place for all shops, regardless of the stock contents held. A lot of insurers may offer further large discounts to the premium if the shop owner lives on or above the premises and is there at night.

Shops by their very nature deal with members of the public and a good insurance policy will usually contain liability cover as standard. This should include Public Liability of up to ?2,000,000 for any one claim by a member of the public who may suffer loss or injury visiting the shop.

If you employ staff all policies will offer Employers Liability cover of up to ?10,000,000 one event and because shops sell goods and services, Products Liability cover of ?2,000,000 for any one period of insurance.

<a href=https://www.cialissansordonnancefr24.com/pharmacie-discount-cialis/>https://www.cialissansordonnancefr24.com/pharmacie-discount-cialis/</a>

 |