---
schema_version: "1"
id: d0ebc922e4a6d140d84bfa0eff17d314e303bbd6c5dea69e368579c73cfd60d0
title: Pubsub Component ReadMe Previous Releases (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_pubsub_component_previous_releases.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_pubsub_component_previous_releases.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 8df75744e6172b341fd42c776668d81535d18318504daa50a2efdc226c645f84
description: For the managed package runtime, this page contains the Pubsub Component ReadMe for older releases.
products:
  - Omnistudio
release: "264"
---
# Pubsub Component ReadMe Previous Releases (Managed Package)

For the managed package runtime, this page contains the Pubsub Component ReadMe for older releases.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

For the most recent version of the Pubsub Component ReadMe, see [Pubsub Component (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_pubsub_component.htm&release=264.0.0&type=5 "For the managed package runtime, the Pubsub Component enables data sharing and passing messages between components that aren’t ancestors. Multiple components can register and receive data from the same channel.").

## Vlocity Insurance and Health Spring '20

The _Pubsub Component_ enables data sharing between components. Multiple components can register and receive data from the same channel.

This component exposes 4 functions:

- register
- unregister
- fire
- shouldExecuteCallbackHandler.shouldExecuteCallback

## Available Methods

## Register

Register a callback for an event.

```javascript
pubsub.register(this.channel, {
        result: // Pass the payload here
    });

```

## Unregister

Unregister from an event.

```javascript
pubsub.unregister(this.channel, {
        onresult: // Do on successfull disconnect
    });
```

## Fire

Fire an event to a listener.

```javascript
pubsub.fire("Event Name ", "Name of the Action", {
        name: // some name,
        value: // payload
    });
```

## shouldExecuteCallbackHandler.shouldExecuteCallback

Override this function to implement a check before executing the registered callback. This function should return true if you want the callback to execute or return false. The default value returned is true.

```javascript
pubsub.shouldExecuteCallbackHandler.shouldExecuteCallback = (callback,payload)=>{
        //implement the function to return true if you want the callback to execute else return false.
        if(condition){ //some condition.
            return true;
        }else{
            return false;
        }
    }
```

## Register and Receive Data from Multiple Components

```javascript
// Inside sending component
    pubsub.fire("Notify", "sendNotification", {
        name: "Notify",
        value: // payload
    });

    // Inside receving component 1
    pubsub.register("Notify", {
        sendNotification: //Do something
    });

    // Inside receving component 2
    pubsub.register("Notify", {
        sendNotification: //Do something else
    });
```

## Vlocity Insurance and Health Summer '19 and CME Fall '19

The _Pubsub Component_ enables data sharing between components. Multiple components can register and receive data from the same channel.

This component exposes 3 functions:

- register
- unregister
- fire

## Available Methods

## Register

Register a callback for an event.

```javascript
pubsub.register(this.channel, {
        result: // Pass the payload here
    });

```

## Unregister

Unregister from an event.

```javascript
pubsub.unregister(this.channel, {
        onresult: // Do on successfull disconnect
    });
```

## Fire

Fire an event to a listener.

```javascript
pubsub.fire("Event Name ", "Name of the Action", {
        name: // some name,
        value: // payload
    });
```

## Register and Receive Data from Multiple Components

```javascript
// Inside sending component
    pubsub.fire("Notify", "sendNotification", {
        name: "Notify",
        value: // payload
    });

    // Inside receving component 1
    pubsub.register("Notify", {
        sendNotification: //Do something
    });

    // Inside receving component 2
    pubsub.register("Notify", {
        sendNotification: //Do something else
    });
```