mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Allow view providers to specify a createView factory method
If present, it will be called with the model object instead of instantiating the view constructor directly and assigning a model on it. This gives users more flexibility when constructing views.
This commit is contained in:
@@ -29,8 +29,10 @@ class ViewRegistry
|
||||
object[0].__spacePenView ?= object
|
||||
object[0]
|
||||
else if provider = @findProvider(object)
|
||||
element = new provider.viewConstructor
|
||||
element.setModel(object)
|
||||
element = provider.createView?(object)
|
||||
unless element?
|
||||
element = new provider.viewConstructor
|
||||
element.setModel(object)
|
||||
element
|
||||
else if viewConstructor = object?.getViewClass?()
|
||||
view = new viewConstructor(object)
|
||||
|
||||
Reference in New Issue
Block a user