Merge pull request #4121 from atom/format-coffee-helpers

Format leftover CoffeeScript helpers
This commit is contained in:
Cheng Zhao 2016-01-16 13:24:26 +08:00
commit 25afcf2673
7 changed files with 139 additions and 201 deletions

View file

@ -1,28 +1,25 @@
'use strict';
const app = require('electron').app;
const EventEmitter = require('events').EventEmitter;
const url = require('url');
const squirrelUpdate = require('./squirrel-update-win');
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
var AutoUpdater = (function(superClass) {
extend(AutoUpdater, superClass);
function AutoUpdater() {
return AutoUpdater.__super__.constructor.apply(this, arguments);
class AutoUpdater extends EventEmitter {
constructor() {
super();
}
AutoUpdater.prototype.quitAndInstall = function() {
quitAndInstall() {
squirrelUpdate.processStart();
return app.quit();
};
}
AutoUpdater.prototype.setFeedURL = function(updateURL) {
setFeedURL(updateURL) {
return this.updateURL = updateURL;
};
}
AutoUpdater.prototype.checkForUpdates = function() {
checkForUpdates() {
if (!this.updateURL) {
return this.emitError('Update URL is not set');
}
@ -55,17 +52,13 @@ var AutoUpdater = (function(superClass) {
});
};
})(this));
};
}
// Private: Emit both error object and message, this is to keep compatibility
// with Old APIs.
AutoUpdater.prototype.emitError = function(message) {
emitError(message) {
return this.emit('error', new Error(message), message);
};
return AutoUpdater;
})(EventEmitter);
}
}
module.exports = new AutoUpdater;

View file

@ -4,7 +4,8 @@ const binding = process.atomBinding('dialog');
const v8Util = process.atomBinding('v8_util');
var slice = [].slice;
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
var includes = [].includes;
var indexOf = [].indexOf;
var fileDialogProperties = {
openFile: 1 << 0,
@ -61,7 +62,7 @@ module.exports = {
properties = 0;
for (prop in fileDialogProperties) {
value = fileDialogProperties[prop];
if (indexOf.call(options.properties, prop) >= 0) {
if (includes.call(options.properties, prop)) {
properties |= value;
}
}