mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
33 lines
727 B
CoffeeScript
33 lines
727 B
CoffeeScript
Q = require 'q'
|
|
Package = require './package'
|
|
|
|
module.exports =
|
|
class ThemePackage extends Package
|
|
getType: -> 'theme'
|
|
|
|
getStylesheetType: -> 'theme'
|
|
|
|
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
|