Initialize AtomPackage attributes earlier

This should make our package loading process a bit more robust.
This commit is contained in:
Matt Colyer
2013-10-11 11:56:12 -07:00
parent abd8bd1253
commit 12b42bf459
5 changed files with 27 additions and 19 deletions

View File

@@ -28,26 +28,28 @@ class AtomPackage extends Package
getType: -> 'atom'
load: ->
@metadata = {}
@stylesheets = []
@keymaps = []
@menus = []
@grammars = []
@scopedProperties = []
@measure 'loadTime', =>
try
@metadata = Package.loadMetadata(@path)
if @isTheme()
@stylesheets = []
@keymaps = []
@menus = []
@grammars = []
@scopedProperties = []
else
@loadKeymaps()
@loadMenus()
@loadStylesheets()
@loadGrammars()
@loadScopedProperties()
return if @isTheme()
if @metadata.activationEvents?
@registerDeferredDeserializers()
else
@requireMainModule()
@loadKeymaps()
@loadMenus()
@loadStylesheets()
@loadGrammars()
@loadScopedProperties()
if @metadata.activationEvents?
@registerDeferredDeserializers()
else
@requireMainModule()
catch e
console.warn "Failed to load package named '#{@name}'", e.stack ? e