Class ViewRegistry
- Defined in: ViewRegistry.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
ViewRegistry(views)
|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
|
addView(name, view)
Registers a view with the specified name.
|
|
|
addViews(views)
Adds the given views.
|
|
|
getView(view)
Returns the view having the specified name.
|
|
|
loadViews(dir, type)
Loads all files in the given directory into view objects of the
specified type.
|
|
|
render(name, model, layout)
Recursively renders the given/named view and its parent(s) and returns
the result.
|
Class Detail
ViewRegistry(views)
- Parameters:
- views
- optional map of view objects
Method Detail
-
addView(name, view)Registers a view with the specified name.
- Parameters:
- name
- view
-
addViews(views)Adds the given views.
- Parameters:
- views
- an map of view names to template objects
-
getView(view)Returns the view having the specified name.
- Parameters:
- view
- the name of the view
-
loadViews(dir, type)Loads all files in the given directory into view objects of the specified type.
- Parameters:
- dir
- directory path
- type
- a view class constructor
- Returns:
- promise completion promise
-
render(name, model, layout)Recursively renders the given/named view and its parent(s) and returns the result.
- Parameters:
- name
- a View object or the name of the view to render
- model
- the model for the view
- layout
- the default parent view
- Returns:
- string