Updated docs for beginFrameSubscription

This commit is contained in:
Heilig Benedek 2016-06-21 13:35:30 +02:00
parent 3529f8a40a
commit 712141f153

View file

@ -917,12 +917,14 @@ For the `mouseWheel` event, the `event` object also have following properties:
* `hasPreciseScrollingDeltas` Boolean * `hasPreciseScrollingDeltas` Boolean
* `canScroll` Boolean * `canScroll` Boolean
### `webContents.beginFrameSubscription(callback)` ### `webContents.beginFrameSubscription(callback, onlyDamaged)`
* `callback` Function * `callback` Function
* `onlyDamaged` Boolean
Begin subscribing for presentation events and captured frames, the `callback` Begin subscribing for presentation events and captured frames, the `callback`
will be called with `callback(frameBuffer)` when there is a presentation event. will be called with `callback(frameBuffer, damagedRect)` when there is a
presentation event.
The `frameBuffer` is a `Buffer` that contains raw pixel data. On most machines, The `frameBuffer` is a `Buffer` that contains raw pixel data. On most machines,
the pixel data is effectively stored in 32bit BGRA format, but the actual the pixel data is effectively stored in 32bit BGRA format, but the actual
@ -930,6 +932,11 @@ representation depends on the endianness of the processor (most modern
processors are little-endian, on machines with big-endian processors the data processors are little-endian, on machines with big-endian processors the data
is in 32bit ARGB format). is in 32bit ARGB format).
The `damagedRect` is an object with `x, y, width, height` properties that
describes which part of the page was repainted. If `onlyDamaged` is set to
`true`, `frameBuffer` will only contain the repainted area. `onlyDamaged`
defaults to `false`.
### `webContents.endFrameSubscription()` ### `webContents.endFrameSubscription()`
End subscribing for frame presentation events. End subscribing for frame presentation events.