IModel The interface definition for a PureMVC Model.

In PureMVC, IModel implementors provide access to IProxy objects by named lookup.

An IModel assumes these responsibilities:

  • Maintain a cache of IProxy instances

  • Provide methods for registering, retrieving, and removing IProxy instances

IModel

interface IModel {
    hasProxy(proxyName: string): boolean;
    registerProxy(proxy: IProxy): void;
    removeProxy(proxyName: string): null | IProxy;
    retrieveProxy(proxyName: string): null | IProxy;
}

Implemented by

Methods

  • Check if a Proxy is registered

    Parameters

    • proxyName: string

      The name of the proxy to check.

    Returns boolean

    True if the IProxy is registered, otherwise false.

  • Register an IProxy instance with the Model.

    Parameters

    • proxy: IProxy

      an object reference to be held by the Model.

    Returns void

  • Remove an IProxy instance from the Model.

    Parameters

    • proxyName: string

      The name of the proxy to remove.

    Returns null | IProxy

    The removed IProxy if found, otherwise null.

  • Retrieve an IProxy instance from the Model.

    Parameters

    • proxyName: string

      The name of the proxy to retrieve.

    Returns null | IProxy

    The IProxy if registered, otherwise null.