Document.handler just returns the class, not an instance

This commit is contained in:
Chris Wanstrath
2011-11-10 11:39:29 -08:00
parent b590d57515
commit 353b2d1840
2 changed files with 5 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ class Document extends Pane
@handlers: {}
@handler: (path) ->
for name, {test, handler} of Document.handlers
return new handler path if test path
return handler if test path
null
@register: (test) ->
Document.handlers[@name] = {test, handler: this}

View File

@@ -30,8 +30,10 @@ for name, method of atom.app
atom[name] = atom.app[name]
atom.path = $atomController.path.toString()
atom.document = Document.handler atom.path
atom.document ?= new Editor
if handler = Document.handler atom.path
atom.document = new handler atom.path
else
atom.document = new Editor
require 'window'
window.startup()