A base Proxy implementation.

In PureMVC, Proxy classes are used to manage parts of the application's data model.

A Proxy might simply manage a reference to a local data object, in which case interacting with it might involve setting and getting of its data in synchronous fashion.

Proxy classes are also used to encapsulate the application's interaction with remote services to save or retrieve data, in which case, we adopt an asynchronous idiom; setting data (or calling a method) on the Proxy and listening for a Notification to be sent when the Proxy has retrieved the data from the service.

Model

Proxy

Hierarchy (view full)

Implements

Constructors

  • Constructor

    Parameters

    • Optionalname: string

      The name of the proxy. Defaults to Proxy.NAME if not provided.

    • Optionaldata: any

      The data associated with the proxy. Can be null.

    Returns Proxy

Properties

_data?: any

the data object

_name: string

the proxy name

facade: IFacade = ...

Return the Singleton Facade instance

The facade instance.

NAME: string = "Proxy"

The default name for the Proxy.

Accessors

  • get data(): any
  • Get the data object

    Returns any

    The current data or undefined if no data is set.

  • set data(value): void
  • Set the data object

    Parameters

    • value: any

      The data to set. Can be null.

    Returns void

  • get name(): string
  • Get the proxy name

    Returns string

    The name of the proxy.

Methods

  • Called by the Model when the Proxy is registered

    Returns void

  • Called by the Model when the Proxy is removed

    Returns void

  • Create and send an Notification.

    Keeps us from having to construct new Notification instances in our implementation code.

    Parameters

    • notificationName: string

      The name of the notification to be sent.

    • Optionalbody: any

      Optional data to be included with the notification.

    • Optionaltype: string

      Optional type of the notification.

    Returns void