new Button(text, backgroundColor, textColor, clickAction, uri, id)
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
text |
string | The text to display on this button |
||
backgroundColor |
integer |
<optional> |
0xff0073d5 | The background color for this button. Hex value with opacity (e.g. |
textColor |
integer |
<optional> |
0xffffffff | The color for the text of this button. Hex value with opacity (e.g. |
clickAction |
ab.InAppMessage.ClickAction |
<optional> |
ab.InAppMessage.ClickAction.NEWS_FEED | Where the user |
uri |
string |
<optional> |
If |
|
id |
int |
<optional> |
The id for this button. Used for analytics. |
Methods
-
removeAllSubscriptions()
-
Remove all event subscriptions from this button.
-
removeSubscription(subscriptionGuid)
-
Remove an event subscription that you previously subscribed to.
Parameters:
Name Type Description subscriptionGuid
string The identifier of the subscription you wish to remove, returned by the method
you initially used to create it. -
subscribeToClickedEvent(subscriber) → {string}
-
Subscribe to receive click events on this button. The subscriber callback will be called whenever this button is
clicked by the user.Parameters:
Name Type Description subscriber
function The callback function to receive click events. This function will be invoked with
no arguments when this button records a click.Returns:
The identifier of the subscription created. This can be passed to removeSubscription
to cancel the subscription.- Type
- string