mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-08 16:19:17 +03:00
Use disposables for removing properties
This commit is contained in:
parent
e2ac19c17f
commit
a8fad6a0fb
@ -335,6 +335,9 @@ describe "PackageManager", ->
|
||||
expect(atom.config.get(['.source.ruby'], 'editor.commentStart')).toBe '# '
|
||||
|
||||
describe "::deactivatePackage(id)", ->
|
||||
afterEach ->
|
||||
atom.packages.unloadPackages()
|
||||
|
||||
describe "atom packages", ->
|
||||
it "calls `deactivate` on the package's main module if activate was successful", ->
|
||||
pack = null
|
||||
|
@ -717,10 +717,6 @@ class Config
|
||||
.join(' ')
|
||||
@scopedSettingsStore.getProperties(scopeChain, keyPath)
|
||||
|
||||
removeScopedSettingsForName: (name) ->
|
||||
@scopedSettingsStore.removeProperties(name)
|
||||
@scopedSettingsStore.removeProperties("#{name}+default")
|
||||
|
||||
clearScopedSettings: ->
|
||||
@scopedSettingsStore = new ScopedPropertyStore
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
CSON = require 'season'
|
||||
{CompositeDisposable} = require 'event-kit'
|
||||
|
||||
module.exports =
|
||||
class ScopedProperties
|
||||
@ -10,10 +11,12 @@ class ScopedProperties
|
||||
callback(null, new ScopedProperties(scopedPropertiesPath, scopedProperties))
|
||||
|
||||
constructor: (@path, @scopedProperties) ->
|
||||
@propertyDisposable = new CompositeDisposable
|
||||
|
||||
activate: ->
|
||||
for selector, properties of @scopedProperties
|
||||
atom.config.addScopedDefaults(@path, selector, properties)
|
||||
@propertyDisposable.add atom.config.addScopedDefaults(@path, selector, properties)
|
||||
return
|
||||
|
||||
deactivate: ->
|
||||
atom.config.removeScopedSettingsForName(@path)
|
||||
@propertyDisposable.dispose()
|
||||
|
@ -44,8 +44,8 @@ class Syntax extends GrammarRegistry
|
||||
atom.config.addScopedDefaults(args...)
|
||||
|
||||
removeProperties: (name) ->
|
||||
deprecate 'A direct (but private) replacement is available at atom.config.removeScopedSettingsForName().'
|
||||
atom.config.removeScopedSettingsForName(name)
|
||||
deprecate 'atom.config.addScopedDefaults() now returns a disposable you can call .dispose() on'
|
||||
atom.config.scopedSettingsStore.removeProperties(name)
|
||||
|
||||
clearProperties: ->
|
||||
deprecate 'A direct (but private) replacement is available at atom.config.clearScopedSettings().'
|
||||
|
Loading…
Reference in New Issue
Block a user