The ModelBoundSubscriptionPlugin enables to store subscriptions for a model element.

If a ModelElement has a subscription to an asynchronous service (e.g., image xlink-href, which resolves the src attribute asynchronously), this plugin can be used to track those subscriptions.

Tracked subscriptions will be unsubscribed on destroy or when the ModelElement has been removed from the document.

The plugin generates an attribute cmSubscriptionId for inserted registered model elements. It listens to changes in the document regarding the registered model elements.

If a registered model element is removed, all subscriptions will be unsubscribed. Subscriptions have to be added manually to the ModelBoundSubscriptionPlugin by calling addSubscription.

Hierarchy (view full)

Constructors

  • Parameters

    • editor: default

    Returns ModelBoundSubscriptionPlugin

    Inherit Doc

Properties

ID_MODEL_ATTRIBUTE_NAME: "cmSubscriptionId" = "cmSubscriptionId"
PLUGIN_NAME: "ModelBoundSubscriptionPlugin" = "ModelBoundSubscriptionPlugin"
pluginName: "ModelBoundSubscriptionPlugin" = ModelBoundSubscriptionPlugin.PLUGIN_NAME

Methods

  • Add a subscription to the subscription cache for unsubscription on related model changes.

    Parameters

    • modelElement: default

      the model element related to the subscription (must contain the cmSubscriptionId).

    • subscription: Subscription

      the subscription

    Returns void

  • Registers a model element to be tracked by the plugin.

    This means for the model elements the attribute cmSubscriptionId will be generated on insertion and added subscriptions will be unsubscribed on element removal and document destroying.

    Parameters

    • modelElementName: string

      the model element name, which is tracked.

    Returns void