Use // for single line comments
This commit is contained in:
parent
26350f4ccb
commit
f4af744519
43 changed files with 311 additions and 310 deletions
|
@ -54,7 +54,7 @@ app.getAppPath = function() {
|
|||
};
|
||||
|
||||
|
||||
/* Routes the events to webContents. */
|
||||
// Routes the events to webContents.
|
||||
|
||||
ref1 = ['login', 'certificate-error', 'select-client-certificate'];
|
||||
fn = function(name) {
|
||||
|
@ -70,7 +70,7 @@ for (i = 0, len = ref1.length; i < len; i++) {
|
|||
}
|
||||
|
||||
|
||||
/* Deprecated. */
|
||||
// Deprecated.
|
||||
|
||||
app.getHomeDir = deprecate('app.getHomeDir', 'app.getPath', function() {
|
||||
return this.getPath('home');
|
||||
|
@ -92,7 +92,7 @@ deprecate.rename(app, 'terminate', 'quit');
|
|||
|
||||
deprecate.event(app, 'finish-launching', 'ready', function() {
|
||||
|
||||
/* give default app a chance to setup default menu. */
|
||||
// give default app a chance to setup default menu.
|
||||
return setImmediate((function(_this) {
|
||||
return function() {
|
||||
return _this.emit('finish-launching');
|
||||
|
@ -109,14 +109,14 @@ deprecate.event(app, 'activate-with-no-open-windows', 'activate', function(event
|
|||
deprecate.event(app, 'select-certificate', 'select-client-certificate');
|
||||
|
||||
|
||||
/* Wrappers for native classes. */
|
||||
// Wrappers for native classes.
|
||||
|
||||
wrapDownloadItem = function(downloadItem) {
|
||||
|
||||
/* downloadItem is an EventEmitter. */
|
||||
// downloadItem is an EventEmitter.
|
||||
downloadItem.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/* Deprecated. */
|
||||
// Deprecated.
|
||||
deprecate.property(downloadItem, 'url', 'getURL');
|
||||
deprecate.property(downloadItem, 'filename', 'getFilename');
|
||||
deprecate.property(downloadItem, 'mimeType', 'getMimeType');
|
||||
|
@ -126,6 +126,6 @@ wrapDownloadItem = function(downloadItem) {
|
|||
downloadItemBindings._setWrapDownloadItem(wrapDownloadItem);
|
||||
|
||||
|
||||
/* Only one App object pemitted. */
|
||||
// Only one App object pemitted.
|
||||
|
||||
module.exports = app;
|
||||
|
|
|
@ -5,7 +5,7 @@ deprecate = require('electron').deprecate;
|
|||
autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
|
||||
|
||||
|
||||
/* Deprecated. */
|
||||
// Deprecated.
|
||||
|
||||
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ AutoUpdater = (function(superClass) {
|
|||
}
|
||||
releaseNotes = update.releaseNotes, version = update.version;
|
||||
|
||||
/* Following information is not available on Windows, so fake them. */
|
||||
// Following information is not available on Windows, so fake them.
|
||||
date = new Date;
|
||||
url = _this.updateURL;
|
||||
return _this.emit('update-downloaded', {}, releaseNotes, version, date, url, function() {
|
||||
|
|
|
@ -7,12 +7,12 @@ path = require('path');
|
|||
spawn = require('child_process').spawn;
|
||||
|
||||
|
||||
/* i.e. my-app/app-0.1.13/ */
|
||||
// i.e. my-app/app-0.1.13/
|
||||
|
||||
appFolder = path.dirname(process.execPath);
|
||||
|
||||
|
||||
/* i.e. my-app/Update.exe */
|
||||
// i.e. my-app/Update.exe
|
||||
|
||||
updateExe = path.resolve(appFolder, '..', 'Update.exe');
|
||||
|
||||
|
@ -33,7 +33,7 @@ spawnUpdate = function(args, detached, callback) {
|
|||
} catch (error1) {
|
||||
error = error1;
|
||||
|
||||
/* Shouldn't happen, but still guard it. */
|
||||
// Shouldn't happen, but still guard it.
|
||||
process.nextTick(function() {
|
||||
return callback(error);
|
||||
});
|
||||
|
@ -54,30 +54,30 @@ spawnUpdate = function(args, detached, callback) {
|
|||
});
|
||||
return spawnedProcess.on('exit', function(code, signal) {
|
||||
|
||||
/* We may have already emitted an error. */
|
||||
// We may have already emitted an error.
|
||||
if (errorEmitted) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Process terminated with error. */
|
||||
// Process terminated with error.
|
||||
if (code !== 0) {
|
||||
return callback("Command failed: " + (signal != null ? signal : code) + "\n" + stderr);
|
||||
}
|
||||
|
||||
/* Success. */
|
||||
// Success.
|
||||
return callback(null, stdout);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/* Start an instance of the installed app. */
|
||||
// Start an instance of the installed app.
|
||||
|
||||
exports.processStart = function(callback) {
|
||||
return spawnUpdate(['--processStart', exeName], true, function() {});
|
||||
};
|
||||
|
||||
|
||||
/* Download the releases specified by the URL and write new results to stdout. */
|
||||
// Download the releases specified by the URL and write new results to stdout.
|
||||
|
||||
exports.download = function(updateURL, callback) {
|
||||
return spawnUpdate(['--download', updateURL], false, function(error, stdout) {
|
||||
|
@ -87,7 +87,7 @@ exports.download = function(updateURL, callback) {
|
|||
}
|
||||
try {
|
||||
|
||||
/* Last line of output is the JSON details about the releases */
|
||||
// Last line of output is the JSON details about the releases
|
||||
json = stdout.trim().split('\n').pop();
|
||||
update = (ref = JSON.parse(json)) != null ? (ref1 = ref.releasesToApply) != null ? typeof ref1.pop === "function" ? ref1.pop() : void 0 : void 0 : void 0;
|
||||
} catch (error1) {
|
||||
|
@ -98,14 +98,14 @@ exports.download = function(updateURL, callback) {
|
|||
};
|
||||
|
||||
|
||||
/* Update the application to the latest remote version specified by URL. */
|
||||
// Update the application to the latest remote version specified by URL.
|
||||
|
||||
exports.update = function(updateURL, callback) {
|
||||
return spawnUpdate(['--update', updateURL], false, callback);
|
||||
};
|
||||
|
||||
|
||||
/* Is the Update.exe installed with the current application? */
|
||||
// Is the Update.exe installed with the current application?
|
||||
|
||||
exports.supported = function() {
|
||||
var error1;
|
||||
|
|
|
@ -10,11 +10,11 @@ BrowserWindow.prototype.__proto__ = EventEmitter.prototype;
|
|||
|
||||
BrowserWindow.prototype._init = function() {
|
||||
|
||||
/* avoid recursive require. */
|
||||
// avoid recursive require.
|
||||
var app, menu;
|
||||
app = require('electron').app;
|
||||
|
||||
/* Simulate the application menu on platforms other than OS X. */
|
||||
// Simulate the application menu on platforms other than OS X.
|
||||
if (process.platform !== 'darwin') {
|
||||
menu = app.getApplicationMenu();
|
||||
if (menu != null) {
|
||||
|
@ -22,7 +22,7 @@ BrowserWindow.prototype._init = function() {
|
|||
}
|
||||
}
|
||||
|
||||
/* Make new windows requested by links behave like "window.open" */
|
||||
// Make new windows requested by links behave like "window.open"
|
||||
this.webContents.on('-new-window', function(event, url, frameName) {
|
||||
var options;
|
||||
options = {
|
||||
|
@ -43,7 +43,7 @@ BrowserWindow.prototype._init = function() {
|
|||
};
|
||||
})(this));
|
||||
|
||||
/* Hide the auto-hide menu when webContents is focused. */
|
||||
// Hide the auto-hide menu when webContents is focused.
|
||||
this.webContents.on('activate', (function(_this) {
|
||||
return function() {
|
||||
if (process.platform !== 'darwin' && _this.isMenuBarAutoHide() && _this.isMenuBarVisible()) {
|
||||
|
@ -52,14 +52,14 @@ BrowserWindow.prototype._init = function() {
|
|||
};
|
||||
})(this));
|
||||
|
||||
/* Forward the crashed event. */
|
||||
// Forward the crashed event.
|
||||
this.webContents.on('crashed', (function(_this) {
|
||||
return function() {
|
||||
return _this.emit('crashed');
|
||||
};
|
||||
})(this));
|
||||
|
||||
/* Change window title to page title. */
|
||||
// Change window title to page title.
|
||||
this.webContents.on('page-title-updated', (function(_this) {
|
||||
return function(event, title, explicitSet) {
|
||||
_this.emit('page-title-updated', event, title);
|
||||
|
@ -81,7 +81,7 @@ BrowserWindow.prototype._init = function() {
|
|||
return this.focus();
|
||||
});
|
||||
|
||||
/* Redirect focus/blur event to app instance too. */
|
||||
// Redirect focus/blur event to app instance too.
|
||||
this.on('blur', (function(_this) {
|
||||
return function(event) {
|
||||
return app.emit('browser-window-blur', event, _this);
|
||||
|
@ -93,10 +93,10 @@ BrowserWindow.prototype._init = function() {
|
|||
};
|
||||
})(this));
|
||||
|
||||
/* Notify the creation of the window. */
|
||||
// Notify the creation of the window.
|
||||
app.emit('browser-window-created', {}, this);
|
||||
|
||||
/* Be compatible with old APIs. */
|
||||
// Be compatible with old APIs.
|
||||
this.webContents.on('devtools-focused', (function(_this) {
|
||||
return function() {
|
||||
return _this.emit('devtools-focused');
|
||||
|
@ -156,7 +156,7 @@ BrowserWindow.fromDevToolsWebContents = function(webContents) {
|
|||
};
|
||||
|
||||
|
||||
/* Helpers. */
|
||||
// Helpers.
|
||||
|
||||
BrowserWindow.prototype.loadURL = function() {
|
||||
return this.webContents.loadURL.apply(this.webContents, arguments);
|
||||
|
@ -203,7 +203,7 @@ BrowserWindow.prototype.inspectServiceWorker = function() {
|
|||
};
|
||||
|
||||
|
||||
/* Deprecated. */
|
||||
// Deprecated.
|
||||
|
||||
deprecate.member(BrowserWindow, 'undo', 'webContents');
|
||||
|
||||
|
|
|
@ -24,14 +24,14 @@ messageBoxOptions = {
|
|||
parseArgs = function(window, options, callback) {
|
||||
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
|
||||
|
||||
/* Shift. */
|
||||
// Shift.
|
||||
callback = options;
|
||||
options = window;
|
||||
window = null;
|
||||
}
|
||||
if ((callback == null) && typeof options === 'function') {
|
||||
|
||||
/* Shift. */
|
||||
// Shift.
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ module.exports = {
|
|||
options.defaultId = -1;
|
||||
}
|
||||
|
||||
/* Choose a default button to get selected when dialog is cancelled. */
|
||||
// Choose a default button to get selected when dialog is cancelled.
|
||||
if (options.cancelId == null) {
|
||||
options.cancelId = 0;
|
||||
ref2 = options.buttons;
|
||||
|
@ -166,7 +166,7 @@ module.exports = {
|
|||
};
|
||||
|
||||
|
||||
/* Mark standard asynchronous functions. */
|
||||
// Mark standard asynchronous functions.
|
||||
|
||||
ref1 = ['showMessageBox', 'showOpenDialog', 'showSaveDialog'];
|
||||
for (j = 0, len = ref1.length; j < len; j++) {
|
||||
|
|
|
@ -3,13 +3,13 @@ var common;
|
|||
common = require('../../../../common/api/lib/exports/electron');
|
||||
|
||||
|
||||
/* Import common modules. */
|
||||
// Import common modules.
|
||||
|
||||
common.defineProperties(exports);
|
||||
|
||||
Object.defineProperties(exports, {
|
||||
|
||||
/* Browser side modules, please sort with alphabet order. */
|
||||
// Browser side modules, please sort with alphabet order.
|
||||
app: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
|
@ -101,7 +101,7 @@ Object.defineProperties(exports, {
|
|||
}
|
||||
},
|
||||
|
||||
/* The internal modules, invisible unless you know their names. */
|
||||
// The internal modules, invisible unless you know their names.
|
||||
NavigationController: {
|
||||
get: function() {
|
||||
return require('../navigation-controller');
|
||||
|
|
|
@ -3,7 +3,7 @@ var deprecate, ipcMain, ref;
|
|||
ref = require('electron'), deprecate = ref.deprecate, ipcMain = ref.ipcMain;
|
||||
|
||||
|
||||
/* This module is deprecated, we mirror everything from ipcMain. */
|
||||
// This module is deprecated, we mirror everything from ipcMain.
|
||||
|
||||
deprecate.warn('ipc module', 'require("electron").ipcMain');
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ v8Util = process.atomBinding('v8_util');
|
|||
nextCommandId = 0;
|
||||
|
||||
|
||||
/* Maps role to methods of webContents */
|
||||
// Maps role to methods of webContents
|
||||
|
||||
rolesMap = {
|
||||
undo: 'undo',
|
||||
|
@ -19,7 +19,7 @@ rolesMap = {
|
|||
};
|
||||
|
||||
|
||||
/* Maps methods that should be called directly on the BrowserWindow instance */
|
||||
// Maps methods that should be called directly on the BrowserWindow instance
|
||||
|
||||
methodInBrowserWindow = {
|
||||
minimize: true,
|
||||
|
@ -59,7 +59,7 @@ MenuItem = (function() {
|
|||
this.click = (function(_this) {
|
||||
return function(focusedWindow) {
|
||||
|
||||
/* Manually flip the checked flags when clicked. */
|
||||
// Manually flip the checked flags when clicked.
|
||||
var methodName, ref1, ref2;
|
||||
if ((ref1 = _this.type) === 'checkbox' || ref1 === 'radio') {
|
||||
_this.checked = !_this.checked;
|
||||
|
|
|
@ -9,15 +9,15 @@ v8Util = process.atomBinding('v8_util');
|
|||
bindings = process.atomBinding('menu');
|
||||
|
||||
|
||||
/* Automatically generated radio menu item's group id. */
|
||||
// Automatically generated radio menu item's group id.
|
||||
|
||||
nextGroupId = 0;
|
||||
|
||||
|
||||
/* Search between seperators to find a radio menu item and return its group id, */
|
||||
// Search between seperators to find a radio menu item and return its group id,
|
||||
|
||||
|
||||
/* otherwise generate a group id. */
|
||||
// otherwise generate a group id.
|
||||
|
||||
generateGroupId = function(items, pos) {
|
||||
var i, item, j, k, ref1, ref2, ref3;
|
||||
|
@ -46,7 +46,7 @@ generateGroupId = function(items, pos) {
|
|||
};
|
||||
|
||||
|
||||
/* Returns the index of item according to |id|. */
|
||||
// Returns the index of item according to |id|.
|
||||
|
||||
indexOfItemById = function(items, id) {
|
||||
var i, item, j, len;
|
||||
|
@ -60,7 +60,7 @@ indexOfItemById = function(items, id) {
|
|||
};
|
||||
|
||||
|
||||
/* Returns the index of where to insert the item according to |position|. */
|
||||
// Returns the index of where to insert the item according to |position|.
|
||||
|
||||
indexToInsertByPosition = function(items, position) {
|
||||
var id, insertIndex, query, ref1;
|
||||
|
@ -79,7 +79,7 @@ indexToInsertByPosition = function(items, position) {
|
|||
break;
|
||||
case 'endof':
|
||||
|
||||
/* If the |id| doesn't exist, then create a new group with the |id|. */
|
||||
// If the |id| doesn't exist, then create a new group with the |id|.
|
||||
if (insertIndex === -1) {
|
||||
items.push({
|
||||
id: id,
|
||||
|
@ -88,7 +88,7 @@ indexToInsertByPosition = function(items, position) {
|
|||
insertIndex = items.length - 1;
|
||||
}
|
||||
|
||||
/* Find the end of the group. */
|
||||
// Find the end of the group.
|
||||
insertIndex++;
|
||||
while (insertIndex < items.length && items[insertIndex].type !== 'separator') {
|
||||
insertIndex++;
|
||||
|
@ -145,7 +145,7 @@ Menu.prototype._init = function() {
|
|||
menuWillShow: (function(_this) {
|
||||
return function() {
|
||||
|
||||
/* Make sure radio groups have at least one menu item seleted. */
|
||||
// Make sure radio groups have at least one menu item seleted.
|
||||
var checked, group, id, j, len, radioItem, ref1, results;
|
||||
ref1 = _this.groupsMap;
|
||||
results = [];
|
||||
|
@ -175,7 +175,7 @@ Menu.prototype._init = function() {
|
|||
Menu.prototype.popup = function(window, x, y) {
|
||||
if ((window != null ? window.constructor : void 0) !== BrowserWindow) {
|
||||
|
||||
/* Shift. */
|
||||
// Shift.
|
||||
y = x;
|
||||
x = window;
|
||||
window = BrowserWindow.getFocusedWindow();
|
||||
|
@ -211,14 +211,14 @@ Menu.prototype.insert = function(pos, item) {
|
|||
break;
|
||||
case 'radio':
|
||||
|
||||
/* Grouping radio menu items. */
|
||||
// Grouping radio menu items.
|
||||
item.overrideReadOnlyProperty('groupId', generateGroupId(this.items, pos));
|
||||
if ((base = this.groupsMap)[name = item.groupId] == null) {
|
||||
base[name] = [];
|
||||
}
|
||||
this.groupsMap[item.groupId].push(item);
|
||||
|
||||
/* Setting a radio menu item should flip other items in the group. */
|
||||
// Setting a radio menu item should flip other items in the group.
|
||||
v8Util.setHiddenValue(item, 'checked', item.checked);
|
||||
Object.defineProperty(item, 'checked', {
|
||||
enumerable: true,
|
||||
|
@ -251,16 +251,16 @@ Menu.prototype.insert = function(pos, item) {
|
|||
this.setRole(pos, item.role);
|
||||
}
|
||||
|
||||
/* Make menu accessable to items. */
|
||||
// Make menu accessable to items.
|
||||
item.overrideReadOnlyProperty('menu', this);
|
||||
|
||||
/* Remember the items. */
|
||||
// Remember the items.
|
||||
this.items.splice(pos, 0, item);
|
||||
return this.commandsMap[item.commandId] = item;
|
||||
};
|
||||
|
||||
|
||||
/* Force menuWillShow to be called */
|
||||
// Force menuWillShow to be called
|
||||
|
||||
Menu.prototype._callMenuWillShow = function() {
|
||||
var item, j, len, ref1, ref2, results;
|
||||
|
@ -286,7 +286,7 @@ Menu.setApplicationMenu = function(menu) {
|
|||
throw new TypeError('Invalid menu');
|
||||
}
|
||||
|
||||
/* Keep a reference. */
|
||||
// Keep a reference.
|
||||
applicationMenu = menu;
|
||||
if (process.platform === 'darwin') {
|
||||
if (menu === null) {
|
||||
|
@ -324,7 +324,7 @@ Menu.buildFromTemplate = function(template) {
|
|||
insertIndex = indexToInsertByPosition(positionedTemplate, item.position);
|
||||
} else {
|
||||
|
||||
/* If no |position| is specified, insert after last item. */
|
||||
// If no |position| is specified, insert after last item.
|
||||
insertIndex++;
|
||||
}
|
||||
positionedTemplate.splice(insertIndex, 0, item);
|
||||
|
|
|
@ -4,7 +4,7 @@ var NavigationController, ipcMain,
|
|||
ipcMain = require('electron').ipcMain;
|
||||
|
||||
|
||||
/* The history operation in renderer is redirected to browser. */
|
||||
// The history operation in renderer is redirected to browser.
|
||||
|
||||
ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function() {
|
||||
var args, event, method, ref;
|
||||
|
@ -32,7 +32,7 @@ NavigationController = (function() {
|
|||
this.webContents = webContents;
|
||||
this.clearHistory();
|
||||
|
||||
/* webContents may have already navigated to a page. */
|
||||
// webContents may have already navigated to a page.
|
||||
if (this.webContents._getURL()) {
|
||||
this.currentIndex++;
|
||||
this.history.push(this.webContents._getURL());
|
||||
|
@ -42,26 +42,26 @@ NavigationController = (function() {
|
|||
var currentEntry;
|
||||
if (_this.inPageIndex > -1 && !inPage) {
|
||||
|
||||
/* Navigated to a new page, clear in-page mark. */
|
||||
// Navigated to a new page, clear in-page mark.
|
||||
_this.inPageIndex = -1;
|
||||
} else if (_this.inPageIndex === -1 && inPage) {
|
||||
|
||||
/* Started in-page navigations. */
|
||||
// Started in-page navigations.
|
||||
_this.inPageIndex = _this.currentIndex;
|
||||
}
|
||||
if (_this.pendingIndex >= 0) {
|
||||
|
||||
/* Go to index. */
|
||||
// Go to index.
|
||||
_this.currentIndex = _this.pendingIndex;
|
||||
_this.pendingIndex = -1;
|
||||
return _this.history[_this.currentIndex] = url;
|
||||
} else if (replaceEntry) {
|
||||
|
||||
/* Non-user initialized navigation. */
|
||||
// Non-user initialized navigation.
|
||||
return _this.history[_this.currentIndex] = url;
|
||||
} else {
|
||||
|
||||
/* Normal navigation. Clear history. */
|
||||
// Normal navigation. Clear history.
|
||||
_this.history = _this.history.slice(0, _this.currentIndex + 1);
|
||||
currentEntry = _this.history[_this.currentIndex];
|
||||
if ((currentEntry != null ? currentEntry.url : void 0) !== url) {
|
||||
|
|
|
@ -9,7 +9,7 @@ if (!app.isReady()) {
|
|||
protocol = process.atomBinding('protocol').protocol;
|
||||
|
||||
|
||||
/* Warn about removed APIs. */
|
||||
// Warn about removed APIs.
|
||||
|
||||
logAndThrow = function(callback, message) {
|
||||
console.error(message);
|
||||
|
|
|
@ -7,7 +7,7 @@ bindings = process.atomBinding('session');
|
|||
PERSIST_PERFIX = 'persist:';
|
||||
|
||||
|
||||
/* Returns the Session from |partition| string. */
|
||||
// Returns the Session from |partition| string.
|
||||
|
||||
exports.fromPartition = function(partition) {
|
||||
if (partition == null) {
|
||||
|
@ -24,7 +24,7 @@ exports.fromPartition = function(partition) {
|
|||
};
|
||||
|
||||
|
||||
/* Returns the default session. */
|
||||
// Returns the default session.
|
||||
|
||||
Object.defineProperty(exports, 'defaultSession', {
|
||||
enumerable: true,
|
||||
|
@ -35,7 +35,7 @@ Object.defineProperty(exports, 'defaultSession', {
|
|||
|
||||
wrapSession = function(session) {
|
||||
|
||||
/* session is an EventEmitter. */
|
||||
// session is an EventEmitter.
|
||||
return session.__proto__ = EventEmitter.prototype;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ Tray.prototype.__proto__ = EventEmitter.prototype;
|
|||
|
||||
Tray.prototype._init = function() {
|
||||
|
||||
/* Deprecated. */
|
||||
// Deprecated.
|
||||
deprecate.rename(this, 'popContextMenu', 'popUpContextMenu');
|
||||
deprecate.event(this, 'clicked', 'click');
|
||||
deprecate.event(this, 'double-clicked', 'double-click');
|
||||
|
@ -21,7 +21,7 @@ Tray.prototype._init = function() {
|
|||
Tray.prototype.setContextMenu = function(menu) {
|
||||
this._setContextMenu(menu);
|
||||
|
||||
/* Keep a strong reference of menu. */
|
||||
// Keep a strong reference of menu.
|
||||
return this.menu = menu;
|
||||
};
|
||||
|
||||
|
|
|
@ -66,18 +66,18 @@ const webFrameMethods = [
|
|||
|
||||
wrapWebContents = function(webContents) {
|
||||
|
||||
/* webContents is an EventEmitter. */
|
||||
// webContents is an EventEmitter.
|
||||
var controller, method, name, ref1;
|
||||
webContents.__proto__ = EventEmitter.prototype;
|
||||
|
||||
/* WebContents::send(channel, args..) */
|
||||
// WebContents::send(channel, args..)
|
||||
webContents.send = function() {
|
||||
var args, channel;
|
||||
channel = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
||||
return this._send(channel, slice.call(args));
|
||||
};
|
||||
|
||||
/* The navigation controller. */
|
||||
// The navigation controller.
|
||||
controller = new NavigationController(webContents);
|
||||
ref1 = NavigationController.prototype;
|
||||
for (name in ref1) {
|
||||
|
@ -109,7 +109,7 @@ wrapWebContents = function(webContents) {
|
|||
return this.once('did-finish-load', executeJavaScript.bind(this, code, hasUserGesture));
|
||||
};
|
||||
|
||||
/* Dispatch IPC messages to the ipc module. */
|
||||
// Dispatch IPC messages to the ipc module.
|
||||
webContents.on('ipc-message', function(event, packed) {
|
||||
var args, channel;
|
||||
channel = packed[0], args = 2 <= packed.length ? slice.call(packed, 1) : [];
|
||||
|
@ -126,14 +126,14 @@ wrapWebContents = function(webContents) {
|
|||
return ipcMain.emit.apply(ipcMain, [channel, event].concat(slice.call(args)));
|
||||
});
|
||||
|
||||
/* Handle context menu action request from pepper plugin. */
|
||||
// Handle context menu action request from pepper plugin.
|
||||
webContents.on('pepper-context-menu', function(event, params) {
|
||||
var menu;
|
||||
menu = Menu.buildFromTemplate(params.menu);
|
||||
return menu.popup(params.x, params.y);
|
||||
});
|
||||
|
||||
/* This error occurs when host could not be found. */
|
||||
// This error occurs when host could not be found.
|
||||
webContents.on('did-fail-provisional-load', function() {
|
||||
var args;
|
||||
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||
|
@ -149,7 +149,7 @@ wrapWebContents = function(webContents) {
|
|||
})(this));
|
||||
});
|
||||
|
||||
/* Delays the page-title-updated event to next tick. */
|
||||
// Delays the page-title-updated event to next tick.
|
||||
webContents.on('-page-title-updated', function() {
|
||||
var args;
|
||||
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||
|
@ -160,7 +160,7 @@ wrapWebContents = function(webContents) {
|
|||
})(this));
|
||||
});
|
||||
|
||||
/* Deprecated. */
|
||||
// Deprecated.
|
||||
deprecate.rename(webContents, 'loadUrl', 'loadURL');
|
||||
deprecate.rename(webContents, 'getUrl', 'getURL');
|
||||
deprecate.event(webContents, 'page-title-set', 'page-title-updated', function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue