electron/atom/renderer/api/lib/desktop-capturer.coffee
Haojian Wu fb4efec55d Add options check.
This patch avoids main process never response back to renderer if the options is
invalid.
2015-10-19 11:06:56 +08:00

11 lines
483 B
CoffeeScript

ipc = require 'ipc'
NativeImage = require 'native-image'
getSources = (options, callback) ->
ipc.send 'ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', options
ipc.once 'ATOM_RENDERER_DESKTOP_CAPTURER_RESULT', (error_message, sources) ->
error = if error_message then Error error_message else null
callback error, ({id: source.id, name: source.name, thumbnail: NativeImage.createFromDataUrl source.thumbnail} for source in sources)
module.exports =
getSources: getSources