2015-10-04 01:35:00 +00:00
|
|
|
ipc = require 'ipc'
|
|
|
|
NativeImage = require 'native-image'
|
|
|
|
|
2015-10-19 10:07:35 +00:00
|
|
|
nextId = 0
|
|
|
|
getNextId = -> ++nextId
|
|
|
|
|
2015-10-06 06:34:54 +00:00
|
|
|
getSources = (options, callback) ->
|
2015-10-19 10:07:35 +00:00
|
|
|
id = getNextId()
|
|
|
|
ipc.send 'ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', options, id
|
|
|
|
ipc.once "ATOM_RENDERER_DESKTOP_CAPTURER_RESULT_#{id}", (error_message, sources) ->
|
2015-10-19 02:54:12 +00:00
|
|
|
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)
|
2015-10-04 01:35:00 +00:00
|
|
|
|
2015-10-06 06:34:54 +00:00
|
|
|
module.exports =
|
|
|
|
getSources: getSources
|