Module: alfresco/services/BaseService

alfresco/services/BaseService

This module should be extended by all Aikau services as it provides a clean way of ensuring that if a duplicate of the same service is created (configured to use the same pubSubScope) that it's subscriptions will not be created. This is achieved by the extending service module defining all it's subscription creation code in the registerSubscriptions that is only called if an instance of that service does not already exist. Descendant services should override the registerSubscriptions and avoid definining their own constructor function.
Since:
  • 1.0.32
Author:
  • Dave Draper
License:
Source:

Methods

constructor(args)

Creates the service and checks to see whether or not another instance configured on the same pubSubScope has already been registered and if not calls the registerSubscriptions function (which should be overridden by the extending service).
Parameters:
Name Type Description
args array Constructor arguments
Source:

initService()

If a service needs to act upon its post-mixed-in state before registering subscriptions then this is where it should be done. It is comparable to postMixInProperties in a widget in the class lifecycle.
Since:
  • 1.0.52
Source:

mergeTopicsIntoXhrPayload(requestPayload, xhrPayload)

This function can be called before making an XHR call in order to ensure publication relevant topics such as
Parameters:
Name Type Description
requestPayload object The payload published making the request on the service
xhrPayload object The payload to be published to make the XHR request
Since:
  • 1.0.85
Source:

registerSubscriptions()

This function should be overridden by extending services to register their subscriptions.
Source: