Destructure objects

This commit is contained in:
Kevin Sawicki 2016-03-21 11:09:29 -07:00
parent 4127b524d5
commit 2d32956903
2 changed files with 6 additions and 4 deletions

View file

@ -1,3 +1,5 @@
'use strict';
const ipcMain = require('electron').ipcMain;
const desktopCapturer = process.atomBinding('desktop_capturer').desktopCapturer;
@ -33,7 +35,7 @@ ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureW
desktopCapturer.emit = function(event, name, sources) {
// Receiving sources result from main process, now send them back to renderer.
var captureScreen, captureWindow, handledRequest, i, len, ref, ref1, ref2, request, result, source, thumbnailSize, unhandledRequestsQueue;
var handledRequest, i, len, ref, ref1, request, result, source, unhandledRequestsQueue;
handledRequest = requestsQueue.shift(0);
result = (function() {
var i, len, results;
@ -69,7 +71,7 @@ desktopCapturer.emit = function(event, name, sources) {
// If the requestsQueue is not empty, start a new request handling.
if (requestsQueue.length > 0) {
ref2 = requestsQueue[0].options, captureWindow = ref2.captureWindow, captureScreen = ref2.captureScreen, thumbnailSize = ref2.thumbnailSize;
const {captureWindow, captureScreen, thumbnailSize} = requestsQueue[0].options;
return desktopCapturer.startHandling(captureWindow, captureScreen, thumbnailSize);
}
};

View file

@ -216,7 +216,7 @@ let metaToValue = function(meta) {
// Construct a plain object from the meta.
var metaToPlainObject = function(meta) {
var i, len, name, obj, ref1, ref2, value;
var i, len, obj, ref1;
obj = (function() {
switch (meta.type) {
case 'error':
@ -227,7 +227,7 @@ var metaToPlainObject = function(meta) {
})();
ref1 = meta.members;
for (i = 0, len = ref1.length; i < len; i++) {
ref2 = ref1[i], name = ref2.name, value = ref2.value;
let {name, value} = ref1[i];
obj[name] = value;
}
return obj;