Class: DocumentEventManager

document-event-manager.DocumentEventManager(wicaElementConnectionAttributes, wicaElementEventAttributes)

Provides support for periodically scanning the current document for wica-aware elements with attached event handlers or event listeners. Fires a custom OnWicaEvent to inform the attached observers of the latest status received from the wica event stream.

Constructor

new DocumentEventManager(wicaElementConnectionAttributes, wicaElementEventAttributes)

Constructs a new instance.
Parameters:
Name Type Description
wicaElementConnectionAttributes module:shared-definitions.WicaElementConnectionAttributes The names of the wica-aware element attributes that can be examined to determine the name of the channel and its current status. See WicaElementConnectionAttributes.
wicaElementEventAttributes module:shared-definitions.WicaElementEventAttributes The names of the wica-aware element attributes that can be examined to determine whether a wica-aware element has any attached handlers. See WicaElementEventAttributes.

Methods

activate(refreshRateInMillisecondsopt, supportEventListenersopt)

Starts periodically scanning the current document and firing events on all wica channel elements to publish their current state. The event that will be published is called 'onwica'.
Parameters:
Name Type Attributes Default Description
refreshRateInMilliseconds number <optional>
200 The period to wait after each document scan before starting the next one.
supportEventListeners boolean <optional>
false Determines whether events are fired ONLY on elements which have defined event handlers or whether they are fired unconditionally on all elements (as is required to support any attached event listeners). See also: shutdown.

shutdown()

Shuts down the service offered by this class. See also: activate.