mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
33 lines
725 B
CoffeeScript
33 lines
725 B
CoffeeScript
|
Q = require 'q'
|
||
|
Package = require './package'
|
||
|
|
||
|
module.exports =
|
||
|
class ThemePackage extends Package
|
||
|
getType: -> 'theme'
|
||
|
|
||
|
getStyleSheetPriority: -> 1
|
||
|
|
||
|
enable: ->
|
||
|
atom.config.unshiftAtKeyPath('core.themes', @name)
|
||
|
|
||
|
disable: ->
|
||
|
atom.config.removeAtKeyPath('core.themes', @name)
|
||
|
|
||
|
load: ->
|
||
|
@measure 'loadTime', =>
|
||
|
try
|
||
|
@metadata ?= Package.loadMetadata(@path)
|
||
|
catch error
|
||
|
console.warn "Failed to load theme named '#{@name}'", error.stack ? error
|
||
|
this
|
||
|
|
||
|
activate: ->
|
||
|
return @activationDeferred.promise if @activationDeferred?
|
||
|
|
||
|
@activationDeferred = Q.defer()
|
||
|
@measure 'activateTime', =>
|
||
|
@loadStylesheets()
|
||
|
@activateNow()
|
||
|
|
||
|
@activationDeferred.promise
|