Last active
December 13, 2015 17:09
-
-
Save e-jigsaw/4945744 to your computer and use it in GitHub Desktop.
Chrome extensionsでkeydown eventを発火させたいのだけれど、どうにも発火してくれない
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
some "event", -> | |
evt = document.createEvent "KeyboardEvent" | |
evt.initKeyboardEvent "keydown", true, true, null, "J".charCodeAt(0), false, false, false, 0 | |
document.dispatchEvent evt # 何も起きない |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ちゃんと確認してみたら発火してる。でも、
evt.keyCode
とかが0に設定されてて効いてくれないっぽい。http://stackoverflow.com/questions/8942678/keyboardevent-in-chrome-keycode-is-0