Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Also use onDidLoadInitialPackages hook
Browse files Browse the repository at this point in the history
  • Loading branch information
50Wliu committed Nov 5, 2017
1 parent 284c6c7 commit 0658741
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/timecop-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ export default class TimecopView {
constructor ({uri}) {
this.uri = uri
etch.initialize(this)
this.refs.cacheLoadingPanel.populate()
if (atom.packages.hasLoadedInitialPackages()) {
this.populateLoadingViews()
} else {
atom.packages.onDidLoadInitialPackages(() => this.populateLoadingViews())
}

if (atom.packages.hasActivatedInitialPackages()) {
this.populateViews()
this.populateActivationViews()
} else {
atom.packages.onDidActivateInitialPackages(() => this.populateViews())
atom.packages.onDidActivateInitialPackages(() => this.populateActivationViews())
}
}

Expand Down Expand Up @@ -44,12 +51,14 @@ export default class TimecopView {
)
}

populateViews () {
this.refs.windowLoadingPanel.populate()
this.refs.cacheLoadingPanel.populate()
populateLoadingViews () {
this.showLoadedPackages()
this.showActivePackages()
this.showLoadedThemes()
}

populateActivationViews () {
this.refs.windowLoadingPanel.populate()
this.showActivePackages()
this.showActiveThemes()
}

Expand Down
1 change: 1 addition & 0 deletions spec/timecop-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('Timecop', () => {

spyOn(atom.packages, 'getLoadedPackages').andReturn(packages)
spyOn(atom.packages, 'getActivePackages').andReturn(packages)
spyOn(atom.packages, 'hasLoadedInitialPackages').andReturn(true)
spyOn(atom.packages, 'hasActivatedInitialPackages').andReturn(true)

timecopView = await atom.workspace.open('atom://timecop')
Expand Down

0 comments on commit 0658741

Please sign in to comment.