mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-13 21:24:58 +08:00
24 lines
702 B
CoffeeScript
24 lines
702 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) ->
|
||
|
|
||
|
activate: ->
|
||
|
for selector, properties of @scopedProperties
|
||
|
atom.config.set(null, properties, scopeSelector: selector, source: @path)
|
||
|
return
|
||
|
|
||
|
deactivate: ->
|
||
|
for selector of @scopedProperties
|
||
|
atom.config.unset(null, scopeSelector: selector, source: @path)
|
||
|
return
|