mirror of
https://github.com/atom/atom.git
synced 2026-02-04 11:45:16 -05:00
25 lines
849 B
JavaScript
25 lines
849 B
JavaScript
module.exports = {
|
|
activate (state) {
|
|
if (!atom.inDevMode() || atom.inSpecMode()) return
|
|
|
|
if (atom.packages.hasActivatedInitialPackages()) {
|
|
this.startWatching()
|
|
} else {
|
|
this.activatedDisposable = atom.packages.onDidActivateInitialPackages(() => this.startWatching())
|
|
}
|
|
},
|
|
|
|
deactivate () {
|
|
if (this.activatedDisposable) this.activatedDisposable.dispose()
|
|
if (this.commandDisposable) this.commandDisposable.dispose()
|
|
if (this.uiWatcher) this.uiWatcher.destroy()
|
|
},
|
|
|
|
startWatching () {
|
|
const UIWatcher = require('./ui-watcher')
|
|
this.uiWatcher = new UIWatcher({themeManager: atom.themes})
|
|
this.commandDisposable = atom.commands.add('atom-workspace', 'dev-live-reload:reload-all', () => this.uiWatcher.reloadAll())
|
|
if (this.activatedDisposable) this.activatedDisposable.dispose()
|
|
}
|
|
}
|