IProxy The interface definition for a PureMVC Proxy.

In PureMVC, IProxy implementors assume these responsibilities:

  • Implement a common method which returns the name of the Proxy.

  • Provide methods for setting and getting the data object.

Additionally, IProxyies typically:

  • Maintain references to one or more pieces of model data.

  • Provide methods for manipulating that data.

  • Generate INotifications when their model data changes.

  • Expose their name as a public static const called NAME, if they are not instantiated multiple times.

  • Encapsulate interaction with local or remote services used to fetch and persist model data.

IProxy

interface IProxy {
    data?: any;
    name: string;
    onRegister(): void;
    onRemove(): void;
    sendNotification(notificationName: string, body?: any, type?: string): void;
}

Hierarchy (view full)

Implemented by

Properties

data?: any

The data associated with the proxy.

name: 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

  • Send a INotification.

    Convenience method to prevent having to construct new notification instances in our implementation code.

    Parameters

    • notificationName: string

      The name of the notification to send.

    • Optionalbody: any

      Optional data associated with the notification.

    • Optionaltype: string

      Optional type of the notification.

    Returns void