From 418b1bd8f1bb95c79620d9847518aa33abdb4142 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 25 Feb 2016 16:33:39 -0800 Subject: [PATCH] Get rid of the initialize method --- spec/auto-update-manager-spec.js | 5 +++-- src/atom-environment.coffee | 3 +-- src/auto-update-manager.js | 12 +++++------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/spec/auto-update-manager-spec.js b/spec/auto-update-manager-spec.js index 6e3c037ef..2b51ed658 100644 --- a/spec/auto-update-manager-spec.js +++ b/spec/auto-update-manager-spec.js @@ -8,8 +8,9 @@ describe('AutoUpdateManager (renderer)', () => { let autoUpdateManager beforeEach(() => { - autoUpdateManager = new AutoUpdateManager() - autoUpdateManager.initialize(atom.applicationDelegate) + autoUpdateManager = new AutoUpdateManager({ + applicationDelegate: atom.applicationDelegate + }) }) afterEach(() => { diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index f1fe1b459..04074cfcb 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -192,8 +192,7 @@ class AtomEnvironment extends Model @themes.workspace = @workspace @textEditors = new TextEditorRegistry - @autoUpdater = new AutoUpdateManager - @autoUpdater.initialize(@applicationDelegate) + @autoUpdater = new AutoUpdateManager({@applicationDelegate}) @config.load() diff --git a/src/auto-update-manager.js b/src/auto-update-manager.js index 06b437c3b..d811996c1 100644 --- a/src/auto-update-manager.js +++ b/src/auto-update-manager.js @@ -4,23 +4,21 @@ import {Emitter, CompositeDisposable} from 'event-kit' import {ipcRenderer} from 'electron' export default class AutoUpdateManager { - constructor () { + constructor ({applicationDelegate}) { this.subscriptions = new CompositeDisposable() this.emitter = new Emitter() - } - initialize (updateEventEmitter) { this.subscriptions.add( - updateEventEmitter.onDidBeginCheckingForUpdate(() => { + applicationDelegate.onDidBeginCheckingForUpdate(() => { this.emitter.emit('did-begin-checking-for-update') }), - updateEventEmitter.onDidBeginDownloadingUpdate(() => { + applicationDelegate.onDidBeginDownloadingUpdate(() => { this.emitter.emit('did-begin-downloading-update') }), - updateEventEmitter.onDidCompleteDownloadingUpdate((details) => { + applicationDelegate.onDidCompleteDownloadingUpdate((details) => { this.emitter.emit('did-complete-downloading-update', details) }), - updateEventEmitter.onUpdateNotAvailable(() => { + applicationDelegate.onUpdateNotAvailable(() => { this.emitter.emit('update-not-available') }) )