mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
Use subscription to track if disabled packages are observed
This commit is contained in:
parent
f0197632a3
commit
31a154d7eb
@ -32,7 +32,6 @@ class PackageManager
|
||||
@loadedPackages = {}
|
||||
@activePackages = {}
|
||||
@packageStates = {}
|
||||
@observingDisabledPackages = false
|
||||
|
||||
@packageActivators = []
|
||||
@registerPackageActivator(this, ['atom', 'textmate'])
|
||||
@ -129,14 +128,11 @@ class PackageManager
|
||||
@getActivePackage(name)?
|
||||
|
||||
unobserveDisabledPackages: ->
|
||||
return unless @observingDisabledPackages
|
||||
atom.config.unobserve('core.disabledPackages')
|
||||
@observingDisabledPackages = false
|
||||
@disabledPackagesSubscription?.off()
|
||||
@disabledPackagesSubscription = null
|
||||
|
||||
observeDisabledPackages: ->
|
||||
return if @observingDisabledPackages
|
||||
|
||||
atom.config.observe 'core.disabledPackages', callNow: false, (disabledPackages, {previous}) =>
|
||||
@disabledPackagesSubscription ?= atom.config.observe 'core.disabledPackages', callNow: false, (disabledPackages, {previous}) =>
|
||||
packagesToEnable = _.difference(previous, disabledPackages)
|
||||
packagesToDisable = _.difference(disabledPackages, previous)
|
||||
|
||||
@ -144,8 +140,6 @@ class PackageManager
|
||||
@activatePackage(packageName) for packageName in packagesToEnable
|
||||
null
|
||||
|
||||
@observingDisabledPackages = true
|
||||
|
||||
loadPackages: ->
|
||||
# Ensure atom exports is already in the require cache so the load time
|
||||
# of the first package isn't skewed by being the first to require atom
|
||||
|
Loading…
Reference in New Issue
Block a user