Remove a few CoffeeScript generated junks

This commit is contained in:
Cheng Zhao 2016-02-22 14:15:51 +08:00
parent 59d6e7d6ef
commit d4c954870a

View file

@ -11,8 +11,6 @@ const FUNCTION_PROPERTIES = [
'length', 'name', 'arguments', 'caller', 'prototype',
];
var slice = [].slice;
// Return the description of object's members:
let getObjectMemebers = function(object) {
let names = Object.getOwnPropertyNames(object);
@ -281,14 +279,13 @@ ipcMain.on('ATOM_BROWSER_CURRENT_WEB_CONTENTS', function(event) {
});
ipcMain.on('ATOM_BROWSER_CONSTRUCTOR', function(event, id, args) {
var constructor, obj;
try {
args = unwrapArgs(event.sender, args);
constructor = objectsRegistry.get(id);
let constructor = objectsRegistry.get(id);
// Call new with array of arguments.
// http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible
obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)));
let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)));
return event.returnValue = valueToMeta(event.sender, obj);
} catch (error) {
return event.returnValue = exceptionToMeta(error);
@ -296,10 +293,9 @@ ipcMain.on('ATOM_BROWSER_CONSTRUCTOR', function(event, id, args) {
});
ipcMain.on('ATOM_BROWSER_FUNCTION_CALL', function(event, id, args) {
var func;
try {
args = unwrapArgs(event.sender, args);
func = objectsRegistry.get(id);
let func = objectsRegistry.get(id);
return callFunction(event, func, global, args);
} catch (error) {
return event.returnValue = exceptionToMeta(error);
@ -307,13 +303,12 @@ ipcMain.on('ATOM_BROWSER_FUNCTION_CALL', function(event, id, args) {
});
ipcMain.on('ATOM_BROWSER_MEMBER_CONSTRUCTOR', function(event, id, method, args) {
var constructor, obj;
try {
args = unwrapArgs(event.sender, args);
constructor = objectsRegistry.get(id)[method];
let constructor = objectsRegistry.get(id)[method];
// Call new with array of arguments.
obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)));
let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)));
return event.returnValue = valueToMeta(event.sender, obj);
} catch (error) {
return event.returnValue = exceptionToMeta(error);
@ -321,10 +316,9 @@ ipcMain.on('ATOM_BROWSER_MEMBER_CONSTRUCTOR', function(event, id, method, args)
});
ipcMain.on('ATOM_BROWSER_MEMBER_CALL', function(event, id, method, args) {
var obj;
try {
args = unwrapArgs(event.sender, args);
obj = objectsRegistry.get(id);
let obj = objectsRegistry.get(id);
return callFunction(event, obj[method], obj, args);
} catch (error) {
return event.returnValue = exceptionToMeta(error);
@ -332,9 +326,8 @@ ipcMain.on('ATOM_BROWSER_MEMBER_CALL', function(event, id, method, args) {
});
ipcMain.on('ATOM_BROWSER_MEMBER_SET', function(event, id, name, value) {
var obj;
try {
obj = objectsRegistry.get(id);
let obj = objectsRegistry.get(id);
obj[name] = value;
return event.returnValue = null;
} catch (error) {
@ -343,9 +336,8 @@ ipcMain.on('ATOM_BROWSER_MEMBER_SET', function(event, id, name, value) {
});
ipcMain.on('ATOM_BROWSER_MEMBER_GET', function(event, id, name) {
var obj;
try {
obj = objectsRegistry.get(id);
let obj = objectsRegistry.get(id);
return event.returnValue = valueToMeta(event.sender, obj[name]);
} catch (error) {
return event.returnValue = exceptionToMeta(error);
@ -357,21 +349,18 @@ ipcMain.on('ATOM_BROWSER_DEREFERENCE', function(event, id) {
});
ipcMain.on('ATOM_BROWSER_GUEST_WEB_CONTENTS', function(event, guestInstanceId) {
var guestViewManager;
try {
guestViewManager = require('./guest-view-manager');
let guestViewManager = require('./guest-view-manager');
return event.returnValue = valueToMeta(event.sender, guestViewManager.getGuest(guestInstanceId));
} catch (error) {
return event.returnValue = exceptionToMeta(error);
}
});
ipcMain.on('ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', function() {
var args, event, guest, guestInstanceId, guestViewManager, method;
event = arguments[0], guestInstanceId = arguments[1], method = arguments[2], args = 4 <= arguments.length ? slice.call(arguments, 3) : [];
ipcMain.on('ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', function(event, guestInstanceId, method, ...args) {
try {
guestViewManager = require('./guest-view-manager');
guest = guestViewManager.getGuest(guestInstanceId);
let guestViewManager = require('./guest-view-manager');
let guest = guestViewManager.getGuest(guestInstanceId);
return guest[method].apply(guest, args);
} catch (error) {
return event.returnValue = exceptionToMeta(error);