---
url: https://talkjs.com/docs/UI_Components/Other_types_and_functions/
title: "Other types and functions | TalkJS Docs"
---

For AI agents: Find a documentation index at https://talkjs.com/llms.txt (full content at https://talkjs.com/llms-full.txt). Get a markdown version of any page by appending .md to its URL path.

# Other types and functions

Understand top-level utility functions, component events, and shared data types.

### disableFontLoading

```typescript
declare function disableFontLoading(): void;
```

disableFontLoading()

Prevents TalkJS UI components from automatically registering web fonts (`Inter` weights from the TalkJS CDN and the Windows country flag emoji polyfill font).

Call this before mounting any TalkJS UI component. Calling it after a component has already mounted throws an error.

See the [Self-hosting dependencies](https://talkjs.com/docs/Guides/Self_Hosting_Dependencies/) guide for how to self-host or replace TalkJS's fonts with CSS.

#### Returns

void

### setDependencyUrls

```typescript
declare function setDependencyUrls(urls: DependencyUrls): void;
```

setDependencyUrls(urls)

Overrides the URLs from which TalkJS UI components fetch external dependencies such as third-party libraries, emoji datasets, and emoji picker translations.

All fields are optional and are deep-merged with existing values and built-in defaults. Call this before mounting any TalkJS UI component. Calling it after assets have started loading throws an `Error`.

To disable automatic web font loading as well, call [disableFontLoading](https://talkjs.com/docs/UI_Components/Other_types_and_functions/#disableFontLoading). See the [Self-hosting dependencies](https://talkjs.com/docs/Guides/Self_Hosting_Dependencies/) guide for a full example.

#### Parameters

**urls**: [DependencyUrls](https://talkjs.com/docs/UI_Components/Other_types_and_functions/#DependencyUrls)

Partial dependency URL overrides to merge into the current configuration.

#### Returns

void

#### Usage

**Example**

```ts
setDependencyUrls({
  libs: { "emoji-picker-element": "https://cdn.example.com/emoji-picker.js" },
});
```

## interface BackButtonClickEvent

```typescript
interface BackButtonClickEvent {
  currentUser: UserSnapshot;
}
```

An event object dispatched by the [ChatboxProps.onBackButtonClick](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__onBackButtonClick) event.

### Properties

**currentUser**: [UserSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Users/#UserSnapshot)

## type BrowserPermission

```typescript
type BrowserPermission = "notifications" | "microphone" | "geolocation";
```

A string that is one of `"notifications" | "microphone" | "geolocation"`.

Note that more possible values may be added in the future, so make sure your handler can deal with unknown permission types gracefully.

## interface BrowserPermissionRequest

```typescript
interface BrowserPermissionRequest {
  cancel(): void;
  showPrompt(): Promise<"granted" | "denied">;
  type: BrowserPermission;
}
```

Passed to [ChatboxProps.beforeBrowserPermissionPrompt](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__beforeBrowserPermissionPrompt) when a browser permission dialog needs to be shown to the user.

### Method Overview

<table class="my-0"><tbody><tr class="flex flex-col flex-no-wrap sm:table-row"><td><a href="https://talkjs.com/docs/UI_Components/Other_types_and_functions/#BrowserPermissionRequest__cancel" class="no-underline font-mono text-blue-500 hover:text-blue-600 font-medium">cancel</a></td><td><p>Cancel whatever user action caused the permission to be requested.</p></td></tr><tr class="flex flex-col flex-no-wrap sm:table-row"><td><a href="https://talkjs.com/docs/UI_Components/Other_types_and_functions/#BrowserPermissionRequest__showPrompt" class="no-underline font-mono text-blue-500 hover:text-blue-600 font-medium">showPrompt</a></td><td><p>Show the browser permission prompt that lets the user allow or deny this permission.</p></td></tr></tbody></table>

### Properties

**type**: [BrowserPermission](https://talkjs.com/docs/UI_Components/Other_types_and_functions/#BrowserPermission)

The type of permission requested.

Note that more possible values may be added in the future, so make sure your handler can deal with unknown permission types gracefully.

### cancel

_browserPermissionRequest_.cancel()

Cancel whatever user action caused the permission to be requested.

For example, if a user wants to share their location for the first time so that this event is triggered, then if you call `cancel()`, no permission will be requested from the browser, the location sharing will be cancelled, and TalkJS will continue as if the location sharing button had not been clicked at all.

This may be useful if you're using this event to show custom UI elements that nudge users towards granting permission, and this UI has a "cancel" button.

#### Returns

void

### showPrompt

_browserPermissionRequest_.showPrompt(): Promise<"granted" | "denied">

Show the browser permission prompt that lets the user allow or deny this permission.

When the user clicks "Allow", then the user action that triggered the browser permission request will proceed and the return value resolves to `"granted"`.

When the user clicks "Deny", then the user action is cancelled, the `onMissingBrowserPermission` event is triggered, and the return value resolves to `"denied"`.

#### Returns

Promise<"granted" | "denied">

## interface DeleteMessageEvent

```typescript
interface DeleteMessageEvent {
  conversation: ConversationSnapshot;
  currentUser: UserSnapshot;
  message: MessageSnapshot;
}
```

An event object dispatched by the [ChatboxProps.onDeleteMessage](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__onDeleteMessage) event.

### Properties

**conversation**: [ConversationSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Conversations/#ConversationSnapshot)

The conversation that the message used to be in.

**currentUser**: [UserSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Users/#UserSnapshot)

**message**: [MessageSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Messages/#MessageSnapshot)

The message that was just deleted.

## interface DependencyUrls

```typescript
interface DependencyUrls {
  emojiData?: Record<string, string>;
  emojiPickerTranslations?: Record<string, string>;
  libs?: LibUrls;
}
```

Configuration object passed to [setDependencyUrls](https://talkjs.com/docs/UI_Components/Other_types_and_functions/#setDependencyUrls) to override the URLs from which TalkJS UI components fetch external dependencies.

### Properties

**emojiData _(optional)_**: Record<string, string>

Override URLs for emoji dataset JSON files (`emoji-picker-element-data`), keyed by lowercase, hyphen-separated locale code (for example, `"en"`, `"fr"`, `"zh-tw"`).

**emojiPickerTranslations _(optional)_**: Record<string, string>

Override URLs for emoji picker UI translation modules (`emoji-picker-element/i18n/*.js`), keyed by lowercase, hyphen-separated locale code (for example, `"en"`, `"fr"`, `"zh-tw"`).

**libs _(optional)_**: [LibUrls](https://talkjs.com/docs/UI_Components/Other_types_and_functions/#LibUrls)

Override URLs for third-party libraries loaded dynamically at runtime.

## interface FocusMessageEvent

```typescript
interface FocusMessageEvent {
  message: MessageSnapshot | null;
}
```

An event object dispatched by the [ChatboxProps.onFocusMessage](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__onFocusMessage) event.

### Properties

**message**: [MessageSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Messages/#MessageSnapshot) | null

The message that was focused (or `null` if the focus was cleared)

## interface LibUrls

```typescript
interface LibUrls {
  "emoji-picker-element"?: string;
  "mpegts.js"?: string;
  "opus-media-recorder-wasm"?: string;
}
```

Custom URLs for third-party libraries loaded dynamically by TalkJS UI components.

### Properties

**"emoji-picker-element"**: string

URL for the `emoji-picker-element` ESM bundle.

Defaults to `"https://cdn.jsdelivr.net/npm/emoji-picker-element@1.26.3/+esm"`.

**"mpegts.js"**: string

URL for the `mpegts.js` library.

Defaults to `"https://cdn.jsdelivr.net/npm/mpegts.js@1.7.3"`.

**"opus-media-recorder-wasm"**: string

URL for the `opus-media-recorder` WebM Opus encoder WebAssembly binary.

Defaults to `"https://cdn.jsdelivr.net/npm/opus-media-recorder@0.8.0/WebMOpusEncoder.wasm"`.

## interface MessageActionEvent

```typescript
interface MessageActionEvent {
  action: string;
  conversation: ConversationSnapshot;
  message: MessageSnapshot;
  params: Record<string, string>;
}
```

An event object dispatched by the [ChatboxProps.onMessageAction](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__onMessageAction) event.

### Properties

**action**: string

The name of the action that was triggered.

**conversation**: [ConversationSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Conversations/#ConversationSnapshot)

The current conversation.

**message**: [MessageSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Messages/#MessageSnapshot)

The message that contained the action link or action button.

**params**: Record<string, string>

The parameters of the action that was triggered, if any.

## interface MissingBrowserPermissionEvent

```typescript
interface MissingBrowserPermissionEvent {
  type: BrowserPermission;
}
```

Sent by [ChatboxProps.onMissingBrowserPermission](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__onMissingBrowserPermission) when the user tried to do an action that require explicit browser permission, but that permission has been denied.

This event is meant to let you show a message to the user if an action (eg sharing a location, or enabling notifications) can't proceed because the browser permission for that has been denied.

If you want to control when to show the browser permissions prompt, use [ChatboxProps.beforeBrowserPermissionPrompt](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__beforeBrowserPermissionPrompt).

This event is emitted both when the user has denied this permission in the past, and when a user action just triggered a browser permissions prompt which the user then denied. If you need to differentiate between these two cases, use `beforeBrowserPermissionPrompt`, and inspect the return value of [BrowserPermissionRequest.showPrompt](https://talkjs.com/docs/UI_Components/Other_types_and_functions/#BrowserPermissionRequest__showPrompt).

### Properties

**type**: [BrowserPermission](https://talkjs.com/docs/UI_Components/Other_types_and_functions/#BrowserPermission)

The type of permission that was denied.

Note that more possible values may be added in the future, so make sure your handler can deal with unknown permission types gracefully.

## interface SelectConversationEvent

```typescript
interface SelectConversationEvent {
  conversation: ConversationSnapshot | null;
  currentUser: UserSnapshot;
  focusedMessage?: MessageSnapshot;
}
```

An event object dispatched by the [ConversationListProps.onSelectConversation](https://talkjs.com/docs/UI_Components/Web_Components/t-conversation-list/#ConversationListProps__onSelectConversation) event.

### Properties

**conversation**: [ConversationSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Conversations/#ConversationSnapshot) | null

The newly-selected conversation, or `null` if a conversation was de-selected.

**currentUser**: [UserSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Users/#UserSnapshot)

**focusedMessage _(optional)_**: [MessageSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Messages/#MessageSnapshot)

The message that was scrolled into view within the conversation

## interface SendMessageEvent

```typescript
interface SendMessageEvent {
  conversation: ConversationSnapshot;
  currentUser: UserSnapshot;
  message: MessageSnapshot;
}
```

An event object dispatched by the [ChatboxProps.onSendMessage](https://talkjs.com/docs/UI_Components/Web_Components/t-chatbox/#ChatboxProps__onSendMessage) event.

### Properties

**conversation**: [ConversationSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Conversations/#ConversationSnapshot)

The conversation the message was sent in.

**currentUser**: [UserSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Users/#UserSnapshot)

**message**: [MessageSnapshot](https://talkjs.com/docs/Data_APIs/JavaScript/Messages/#MessageSnapshot)

The message that was just sent.
