---
title: "useB24Helper Composable"
description: "Closure-based composable that owns a single B24HelperManager instance and exposes lifecycle helpers (init / destroy / Pull client glue)."
canonical_url: "https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/helper-use-b24-helper"
last_updated: "2026-08-25"
---
# useB24Helper Composable

> Closure-based composable that owns a single B24HelperManager instance and exposes lifecycle helpers (init / destroy / Pull client glue).

## Overview

`useB24Helper()`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} is a factory: each call returns a new closure with its own [`B24HelperManager`](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/helper.md) slot and Pull-client state. It deduplicates init across re-renders and centralises destroy-on-unmount.

```ts
import { useB24Helper, LoadDataType } from '@bitrix24/b24jssdk'

const {
  initB24Helper,
  isInitB24Helper,
  destroyB24Helper,
  getB24Helper,
  usePullClient,
  useSubscribePullClient,
  startPullClient
} = useB24Helper()
```

## Returned API

### `initB24Helper`

```ts-type
initB24Helper(
  $b24: TypeB24,
  dataTypes?: LoadDataType[],
  requestId?: string
): Promise<B24HelperManager>
```

Creates a `B24HelperManager`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} (once per closure) and calls `loadData(dataTypes, requestId)`. Subsequent invocations are no-ops — they return the same manager without re-fetching. `dataTypes` defaults to `[LoadDataType.App, LoadDataType.Profile]`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""}; `requestId` defaults to `'helper-load-data'`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""}.

### `isInitB24Helper`

```ts-type
isInitB24Helper(): boolean
```

Returns `true`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} after `initB24Helper` has resolved at least once.

### `destroyB24Helper`

```ts-type
destroyB24Helper(): void
```

Calls `destroy()` on the underlying manager (closing the Pull client) and resets the closure flags so a new `initB24Helper` call will re-fetch from scratch.

### `getB24Helper`

```ts-type
getB24Helper(): B24HelperManager
```

Returns the live manager. Throws `'B24HelperManager is not initialized. You need to call initB24Helper first.'`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} when called before `initB24Helper`.

### Pull client helpers

```ts-type
usePullClient(): void
useSubscribePullClient(callback: (message: TypePullMessage) => void, moduleId?: string): void
startPullClient(): void
```

Thin wrappers over the matching `B24HelperManager`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} methods. Order: `usePullClient` → `useSubscribePullClient` (one or more) → `startPullClient`. Calling `useSubscribePullClient` or `startPullClient` before `usePullClient` throws `'PullClient is not initialized. You need to call usePullClient first.'`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""}. See [Pull client](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/pull.md).

## `LoadDataType` Enum

```ts-type
enum LoadDataType {
  App = 'app',
  Profile = 'profile',
  Currency = 'currency',
  AppOptions = 'appOptions',
  UserOptions = 'userOptions'
}
```

Each value drives one (or two for `Currency`) REST methods inside the batch — see the table on the [B24HelperManager](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/helper.md#loaddatatype-enum) page.

## Vue Example

```vue
<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue'
import {
  initializeB24Frame,
  useB24Helper,
  LoadDataType,
  type B24Frame
} from '@bitrix24/b24jssdk'

const { initB24Helper, getB24Helper, destroyB24Helper } = useB24Helper()

let $b24: undefined | B24Frame

onMounted(async () => {
  $b24 = await initializeB24Frame()
  await initB24Helper($b24, [
    LoadDataType.Profile,
    LoadDataType.App,
    LoadDataType.Currency
  ])
  console.log('User:', getB24Helper().profileInfo.data)
})

onUnmounted(() => {
  destroyB24Helper()
  $b24?.destroy()
})
</script>
```

## Sitemap

See the full [sitemap](/b24jssdk/sitemap.md) for all pages.
