Clean up theme check in PackageManager with PackageActivators

You can now call `PackageManager.registerPackageActivator` for specific
package types. On `PackageManager.activate` it will call your
`PackageActivator.activatePackages(packages)` with the proper packages.
This commit is contained in:
Ben Ogle
2013-10-22 12:57:37 -07:00
parent 2a7908a196
commit 967c04fb19
4 changed files with 47 additions and 20 deletions

View File

@@ -17,6 +17,7 @@ class ThemeManager
constructor: (@packageManager) ->
@lessCache = null
@packageManager.registerPackageActivator(this, ['theme'])
# Internal-only:
getAvailableNames: ->
@@ -38,6 +39,9 @@ class ThemeManager
getLoadedThemes: ->
pack for pack in @packageManager.getLoadedPackages() when pack.isTheme()
# Internal-only: adhere to the PackageActivator interface
activatePackages: (themePackages) -> @activateThemes()
# Internal-only:
activateThemes: ->
# atom.config.observe runs the callback once, then on subsequent changes.