Skip to main content

Action

OBR.action​

An extensions action is shown in the top left of a room.

When an action is clicked a popover will be shown for that action.

The action is defined in the extensions Manifest file.

Reference

Methods​

getWidth​

async getWidth()

Get the action popovers width.

Returns a number or undefined.


setWidth​

async setWidth(width)

Set the action popovers width.

Parameters

NAMETYPEDESCRIPTION
widthnumberThe new width of the popover

getHeight​

async getHeight()

Get the action popovers height.

Returns a number or undefined.


setHeight​

async setHeight(height)

Set the action popovers height.

Parameters

NAMETYPEDESCRIPTION
heightnumberThe new height of the popover

getBadgeText​

async getBadgeText()

Get the actions badge text.

Returns a string or undefined.


setBadgeText​

async setBadgeText(badgeText)

Set the actions badge text.

Parameters

NAMETYPEDESCRIPTION
badgeTextstringThe new badge text of the action. Set as undefined to remove the badge

getBadgeBackgroundColor​

async getBadgeBackgroundColor()

Get the actions badge background color.

Returns a string or undefined.


setBadgeBackgroundColor​

async setBadgeBackgroundColor(badgeBackgroundColor)

Set the actions badge background color.

Parameters

NAMETYPEDESCRIPTION
badgeBackgroundColorstringThe new badge background color of the action

getIcon​

async getIcon()

Get the actions icon.

Returns a string.


setIcon​

async setIcon(icon)

Set the actions icon.

Parameters

NAMETYPEDESCRIPTION
iconstringThe new icon of the action

getTitle​

async getTitle()

Get the actions title.

Returns a string.


setTitle​

async setTitle(title)

Set the actions title.

Parameters

NAMETYPEDESCRIPTION
titlestringThe new title of the action

open​

async open()

Open the action.


close​

async close()

Close the action.


isOpen​

async isOpen()

Returns true if the action is open


onOpenChange​

onOpenChange(callback);

Parameters

NAMETYPEDESCRIPTION
callback(isOpen: boolean) => voidA callback for when the action is opened or closed

Returns a function that when called will unsubscribe from change events.

Example

/**
* Use an `onOpenChange` event with a React `useEffect`.
* `onOpenChange` returns an unsubscribe event to make this easy.
*/
useEffect(
() =>
OBR.action.onOpenChange((isOpen) => {
// React to the action opening or closing
}),
[]
);