new Button(text, backgroundColor, textColor, borderColor, 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. 0xff00ff00 is opaque green). |
textColor |
integer |
<optional> |
0xffffffff | The color for the text of this button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
borderColor |
integer |
<optional> |
0xff0073d5 | The color for the text of this button. Hex value with opacity (e.g. 0xff00ff00 is opaque green). |
clickAction |
ab.InAppMessage.ClickAction |
<optional> |
ab.InAppMessage.ClickAction.NEWS_FEED | Where the user should be brought when clicking on this button. |
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