new Model()
A Multiton Model
implementation.
In PureMVC, the `Model` class provides access to model objects (Proxies) by named lookup.
The `Model` assumes these responsibilities:
- Maintain a cache of `Proxy` instances.
- Provide methods for registering, retrieving, and removing `Proxy` instances.
Your application must register `Proxy` instances with the `Model`. Typically, you use an `Command` to create and register `Proxy` instances once the `Facade` has initialized the Core actors.
- Source:
- See:
-
- Proxy Proxy
Members
Methods
(static) getInstance(key, factory) → {Model}
Model
Multiton Factory method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
|
factory |
function
|
(static) removeModel(key)
Remove a Model instance
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
hasProxy(proxyName) → {boolean}
Check if a Proxy is registered
- Source:
Parameters:
Name | Type | Description |
---|---|---|
proxyName |
string
|
Returns:
- Type:
-
boolean
whether a Proxy is currently registered with the given proxyName
.
initializeModel()
Initialize the Model
instance.
Called automatically by the constructor, this is your opportunity to initialize the Multiton instance in your subclass without overriding the constructor.
- Source:
registerProxy(proxy)
Register a Proxy
with the Model
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
proxy |
Proxy
|
a |
removeProxy(proxyName) → {Proxy}
Remove a Proxy
from the Model
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
proxyName |
string
|
name of the |
retrieveProxy(proxyName) → {Proxy}
Retrieve a Proxy
from the Model
.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
proxyName |
string
|