Don't use ES6 class for AutoUpdater windows class
This commit is contained in:
parent
3af20729bd
commit
c842ca1f12
1 changed files with 44 additions and 44 deletions
|
@ -4,21 +4,22 @@ const app = require('electron').app;
|
||||||
const EventEmitter = require('events').EventEmitter;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
const squirrelUpdate = require('./squirrel-update-win');
|
const squirrelUpdate = require('./squirrel-update-win');
|
||||||
|
|
||||||
class AutoUpdater extends EventEmitter {
|
function AutoUpdater() {
|
||||||
constructor() {
|
EventEmitter.call(this)
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quitAndInstall() {
|
require('util').inherits(AutoUpdater, EventEmitter);
|
||||||
|
|
||||||
|
AutoUpdater.prototype.quitAndInstall = function() {
|
||||||
squirrelUpdate.processStart();
|
squirrelUpdate.processStart();
|
||||||
return app.quit();
|
return app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFeedURL(updateURL) {
|
AutoUpdater.prototype.setFeedURL = function(updateURL) {
|
||||||
return this.updateURL = updateURL;
|
return this.updateURL = updateURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUpdates() {
|
AutoUpdater.prototype.checkForUpdates = function() {
|
||||||
if (!this.updateURL) {
|
if (!this.updateURL) {
|
||||||
return this.emitError('Update URL is not set');
|
return this.emitError('Update URL is not set');
|
||||||
}
|
}
|
||||||
|
@ -54,9 +55,8 @@ class AutoUpdater extends EventEmitter {
|
||||||
|
|
||||||
// Private: Emit both error object and message, this is to keep compatibility
|
// Private: Emit both error object and message, this is to keep compatibility
|
||||||
// with Old APIs.
|
// with Old APIs.
|
||||||
emitError(message) {
|
AutoUpdater.prototype.emitError = (message) {
|
||||||
return this.emit('error', new Error(message), message);
|
return this.emit('error', new Error(message), message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new AutoUpdater;
|
module.exports = new AutoUpdater;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue