Constructor
new module:caplin/menu/model/MenuFactory()
This class allows the user to create a model from a configuration map.
Example:
{
alias:'caplin.anAlias',
options:
{
label: 'a Label',
otherOption: 'something'
},
items:
[
{
alias:'caplinx.myAlias',
},
{
options:
{
label: 'another label'
}
}
]
}
The table below explains each possible option to represent a caplin.menu.Model
.
name | default | type | description |
---|---|---|---|
alias | String |
The alias for the model to create. This parameter is optional, either a caplin.menu.model.Item or
a caplin.menu.model.Menu will be created in case an alias is not provided.
|
|
options | Map | The options which will be passed to the model that is created. This parameter is optional. | |
items | array |
An array of caplin.menu.Model configuration map representations. This parameter is optional.
|
Methods
-
(static) create(config) → {module:caplin/menu/Model}
-
Returns an instance of a
module:caplin/menu/Model
represented configuration map passed as a parameter.Parameters:
Name Type Description config
Map Map to recreate the model from. Throws:
-
-
If config is not a valid object.
-
-
-
If an instance of
module:caplin/menu/model/Menu
gets generated but no items get provided or the 'items' section is not an array.
-
Returns:
-