Files
atom/src/scoped-properties.coffee
2014-10-03 10:46:57 -07:00

23 lines
676 B
CoffeeScript

CSON = require 'season'
{CompositeDisposable} = require 'event-kit'
module.exports =
class ScopedProperties
@load: (scopedPropertiesPath, callback) ->
CSON.readFile scopedPropertiesPath, (error, scopedProperties={}) ->
if error?
callback(error)
else
callback(null, new ScopedProperties(scopedPropertiesPath, scopedProperties))
constructor: (@path, @scopedProperties) ->
@propertyDisposable = new CompositeDisposable
activate: ->
for selector, properties of @scopedProperties
@propertyDisposable.add atom.config.addScopedSettings(@path, selector, properties)
return
deactivate: ->
@propertyDisposable.dispose()