mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Get rid of the initialize method
This commit is contained in:
@@ -8,8 +8,9 @@ describe('AutoUpdateManager (renderer)', () => {
|
||||
let autoUpdateManager
|
||||
|
||||
beforeEach(() => {
|
||||
autoUpdateManager = new AutoUpdateManager()
|
||||
autoUpdateManager.initialize(atom.applicationDelegate)
|
||||
autoUpdateManager = new AutoUpdateManager({
|
||||
applicationDelegate: atom.applicationDelegate
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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')
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user