visibility
This module provides helpers for patterns regarding changeAreaVisibilityRequest and
didChangeAreaVisibility events.
Contents
Module Members
Types
Module Members
requestPublisherForWidget( context )
Publishes changeWidgetVisibilityRequest events.
Parameters
Property | Type | Description |
---|---|---|
context | AxContext |
the widget context to work on |
Returns
Type | Description |
---|---|
Function |
a function of boolean that requests for widget visibility to be set to the given state |
requestPublisherForArea( context, area )
Publishes changeAreaVisibilityRequest events.
Parameters
Property | Type | Description |
---|---|---|
context | AxContext |
the widget context to work on |
area | String |
the name of a widget area whose visibility is to be controlled by the function returned |
Returns
Type | Description |
---|---|
Function |
a function of boolean that requests for the given area's visibility to be set to the given state |
handlerFor( context, optionalOptions )
Creates a new handler instance for didChangeAreaVisibility events.
Parameters
Property | Type | Description |
---|---|---|
context | AxContext |
the widget context to work on. The visibility handler will manage the boolean context property isVisible which can be used to determine the visibility state of the entire widget |
optionalOptions | Object |
additional options to pass to the visibility handler |
optionalOptions.onChange | Function |
a handler to call when a didChangeAreaVisibility request for this widget's container was received, and the visibility of this widget was changed |
optionalOptions.onShow | Function |
a handler to call when a didChangeAreaVisibility request for this widget's container was received, and the visibility of this widget was changed to true |
optionalOptions.onHide | Function |
a handler to call when a didChangeAreaVisibility request for this widget's container was received, and the visibility of this widget was changed to false |
optionalOptions.onAnyAreaRequest | Function |
a handler for any *changeAreaVisibilityRequest* to this widget's areas The handler must<br>- _either_ return true/ false` to indicate visibility synchronously- or issue a will/did-response for the area when called |
Returns
Type | Description |
---|---|
VisibilityHandler |
a visibility handler instance |
Types
VisibilityHandler
VisibilityHandler.registerArea( areaName, optionalOptions )
Handles changeAreaVisibilityRequest events for a specific area, using a callback.
Parameters
Property | Type | Description |
---|---|---|
areaName | String |
the name of the area for which to handle visibility events |
optionalOptions | Object |
additional options to pass to the visibility handler |
optionalOptions.onRequest | Function |
a callback for any changeAreaVisibilityRequest to this area. The callback may issue a will/did-response for the area when called, or return a boolean which causes the visibility handler to respond accordingly. This should not be used in conjunction with the global onAnyAreaRequest -option of the handler |
Returns
Type | Description |
---|---|
VisibilityHandler |
this instance for chaining |