Model

Model

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

(static) instanceMap :Map.<string, Model>

Source:
Type:

(static) MULTITON_MSG :string

Source:
Type:
  • string

(protected) multitonKey :string

Source:
Type:
  • string

(protected) proxyMap :Map.<string, Proxy>

Source:
Type:

Methods

(static) getInstance(key, factory) → {Model}

Model Multiton Factory method.

Source:
Parameters:
Name Type Description
key string
factory function
Returns:
Type:
Model

the instance for this Multiton key

(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 Proxy to be held by the Model.

removeProxy(proxyName) → {Proxy}

Remove a Proxy from the Model.

Source:
Parameters:
Name Type Description
proxyName string

name of the Proxy instance to be removed.

Returns:
Type:
Proxy

the Proxy that was removed from the Model

retrieveProxy(proxyName) → {Proxy}

Retrieve a Proxy from the Model.

Source:
Parameters:
Name Type Description
proxyName string
Returns:
Type:
Proxy

the Proxy instance previously registered with the given proxyName.

Model

new Model(key)

Constructor.

This `Model` implementation is a Multiton, so you should not call the constructor directly, but instead call the static Multiton Factory method `Model.getInstance( multitonKey )`

Source:
Parameters:
Name Type Description
key string
Throws:

Error if instance for this Multiton key instance has already been constructed

Type
Error

Members

(static) instanceMap :Map.<string, Model>

Source:
Type:

(static) MULTITON_MSG :string

Source:
Type:
  • string

(protected) multitonKey :string

Source:
Type:
  • string

(protected) proxyMap :Map.<string, Proxy>

Source:
Type:

Methods

(static) getInstance(key, factory) → {Model}

Model Multiton Factory method.

Source:
Parameters:
Name Type Description
key string
factory function
Returns:
Type:
Model

the instance for this Multiton key

(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 Proxy to be held by the Model.

removeProxy(proxyName) → {Proxy}

Remove a Proxy from the Model.

Source:
Parameters:
Name Type Description
proxyName string

name of the Proxy instance to be removed.

Returns:
Type:
Proxy

the Proxy that was removed from the Model

retrieveProxy(proxyName) → {Proxy}

Retrieve a Proxy from the Model.

Source:
Parameters:
Name Type Description
proxyName string
Returns:
Type:
Proxy

the Proxy instance previously registered with the given proxyName.