docs: webContents.sendInputEvent
This commit is contained in:
parent
86f523d3c1
commit
573892c112
2 changed files with 40 additions and 64 deletions
|
@ -244,15 +244,6 @@ Emitted when DevTools is closed.
|
|||
|
||||
Emitted when DevTools is focused / opened.
|
||||
|
||||
### Event: 'frame-rendered'
|
||||
|
||||
* `event` Event
|
||||
* `frame` Buffer
|
||||
* `size` Number
|
||||
|
||||
Emitted when *offscreen render* is enabled, the current frame's pixel data
|
||||
and size are available.
|
||||
|
||||
### Event: 'app-command':
|
||||
|
||||
Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx)
|
||||
|
@ -791,58 +782,3 @@ fired when the window receives a new frame from the renderer.
|
|||
|
||||
Enables offscreen rendering, after this call `frame-rendered` events will
|
||||
no longer be fired if offscreen rendering was enabled before.
|
||||
|
||||
### BrowserWindow.sendMouseEvent(options)
|
||||
|
||||
Sends a mouse event to the BrowserWindow.
|
||||
* `options` Object
|
||||
* `type` String - The type of the mouse event.
|
||||
* `down` String - Mouse down event.
|
||||
* `up` String - Mouse up event.
|
||||
* `move` String - Mouse move event.
|
||||
* `enter` String - Mouse enter event.
|
||||
* `leave` String - Mouse leave event.
|
||||
* `context-menu` String - Context menu event.
|
||||
* `wheel` String - Mouse wheel event.
|
||||
* `x` Integer - The x component of the location of the mouse event.
|
||||
* `y` Integer - The y component of the location of the mouse event.
|
||||
* `movement-x` Integer - The x component of the mouse movement since the last event.
|
||||
* `movement-y` Integer - The y component of the mouse movement since the last event.
|
||||
* `button` String - The mouse button associated with the mouse event. Also sets the associated modifier values on the event.
|
||||
* `left` String - The left button was pressed.
|
||||
* `right` String - The right button was pressed.
|
||||
* `middle` String - The middle button was pressed.
|
||||
* `click-count` Integer - The number of clicks associated with the mouse event.
|
||||
* `precise` Boolean - For the `wheel` event type, this option sets the `hasPreciseScrollingDeltas` option of the event.
|
||||
* `modifiers` Object - The modifier values associated with the event.
|
||||
* `left-button-down` Boolean - The left mouse button was pressed.
|
||||
* `middle-button-down` Boolean - The right mouse button was pressed.
|
||||
* `right-button-down` Boolean - The middle mouse button was pressed.
|
||||
* `shift` Boolean - The shift key was pressed.
|
||||
* `control` Boolean - The control key was pressed.
|
||||
* `alt` Boolean - The alt key was pressed.
|
||||
* `meta` Boolean - The meta key was pressed.
|
||||
* `caps-lock` Boolean - The caps-lock key was on.
|
||||
* `num-lock` Boolean - The num-lock key was on.
|
||||
|
||||
### BrowserWindow.sendKeyboardEvent(options)
|
||||
|
||||
Sends a keyboard event to the BrowserWindow.
|
||||
* `options` Object
|
||||
* `type` String - The type of the keyboard event.
|
||||
* `down` String - Key down event.
|
||||
* `up` String - Key up event.
|
||||
* `char` String - Character event.
|
||||
* `code` Integer - The key code of the key that generated the event.
|
||||
* `native` Integer - The native key code of the key that generated the event.
|
||||
* `modifiers` Object - The modifier values associated with the event.
|
||||
* `keypad` Boolean - Sets the `IsKeyPad` option of the event.
|
||||
* `auto-repeat` Boolean - Sets the `IsAutoRepeat` option of the event.
|
||||
* `left` Boolean - Sets the `IsLeft` option of the event.
|
||||
* `right` Boolean - Sets the `IsRight` option of the event.
|
||||
* `shift` Boolean - The shift key was pressed.
|
||||
* `control` Boolean - The control key was pressed.
|
||||
* `alt` Boolean - The alt key was pressed.
|
||||
* `meta` Boolean - The meta key was pressed.
|
||||
* `caps-lock` Boolean - The caps-lock key was on.
|
||||
* `num-lock` Boolean - The num-lock key was on.
|
||||
|
|
|
@ -511,3 +511,43 @@ Enable device emulation with the given parameters.
|
|||
### `webContents.disableDeviceEmulation()`
|
||||
|
||||
Disable device emulation enabled by `webContents.enableDeviceEmulation`.
|
||||
|
||||
### `webContents.sendInputEvent(event)`
|
||||
|
||||
* `event` Object
|
||||
* `type` String (**required**) - The type of the event, can be `mouseDown`,
|
||||
`mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`,
|
||||
`keyDown`, `keyUp`, `char`.
|
||||
* `modifiers` Array - An array of modifiers of the event, can
|
||||
include `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
|
||||
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
|
||||
`numLock`, `left`, `right`.
|
||||
|
||||
Sends an input `event` to the page.
|
||||
|
||||
For keyboard events, the `event` object also have following properties:
|
||||
|
||||
* `keyCode` String (**required**) - A single character that will be sent as
|
||||
keyboard event. Can be any ASCII character on the keyboard, like `a`, `1`
|
||||
and `=`.
|
||||
|
||||
For mouse events, the `event` object also have following properties:
|
||||
|
||||
* `x` Integer (**required**)
|
||||
* `y` Integer (**required**)
|
||||
* `globalX` Integer
|
||||
* `globalY` Integer
|
||||
* `movementX` Integer
|
||||
* `movementY` Integer
|
||||
* `clickCount` Integer
|
||||
|
||||
For the `mouseWheel` event, the `event` object also have following properties:
|
||||
|
||||
* `deltaX` Integer
|
||||
* `deltaY` Integer
|
||||
* `wheelTicksX` Integer
|
||||
* `wheelTicksY` Integer
|
||||
* `accelerationRatioX` Integer
|
||||
* `accelerationRatioY` Integer
|
||||
* `hasPreciseScrollingDeltas` Boolean
|
||||
* `canScroll` Boolean
|
||||
|
|
Loading…
Reference in a new issue