Rate this page:
The jira:issueViewBackgroundScript
module adds an invisible container to the
Issue view page.
This makes it the perfect candidate for:
Because modules might be rendered in a different order, you should handle both scenarios.
Use the events API for communication between an issue view background script and an issue panel.
Issue view background script:
1 2import { events } from '@forge/bridge'; // Emit the data to an already rendered issue panel events.emit('app.data-change', 'initial-data'); // Listen to data change requests from issue panels events.on('app.request-data', (payload) => { events.emit('app.data-change', 'initial-or-changed-data'); });
Issue panel:
1 2import { events } from '@forge/bridge'; // Request data in case the background script is already rendered events.emit('app.request-data'); // Listen to data change events.on('app.data-change', (payload) => { console.log('The data has changed:', payload) });
Property | Type | Required | Description |
---|---|---|---|
key |
| Yes | A key for the module, which other modules can refer to. Must be unique within the manifest.
Regex: |
resource | string | The issue view background script module requires a resource when building with custom UI. | A reference to the static resources entry that the issue view background script will render. See resources for more details. |
resolver | { function: string } | Contains a function property, which references the function module that defines the configuration of resource . Can only be set if the module is using the resource property. |
Property | Type | Description |
---|---|---|
type | string | The type of the module. |
issue:id | string | The ID of the issue on which the module is rendered. |
issue:key | string | The key of the issue on which the module is rendered. |
issue:type | string | The type of the issue on which the module is rendered. |
issue:typeId | string | The ID of the type of the issue on which the module is rendered. |
project:id | string | The ID of the project where the module is rendered. |
project:key | string | The key of the project where the module is rendered. |
project:type | string | The type of the project where the module is rendered. |
Apps can receive a frontend event that will notify your app that an issue has been changed. This event is triggered when an issue is updated or commented on. This event is only available for Jira issue view modules.
1 2import {events} from '@forge/bridge'; events.on('JIRA_ISSUE_CHANGED', (data) => { console.log('JIRA_ISSUE_CHANGED (Forge)', data); });
However, if you have multiple issue view modules in your app, you should use the Jira issue view background script module or its Connect counterpart. This will give you a central place for fetching issue details, thus reducing the number of network requests and improving the user experience. Fetching issue details separately for every module would introduce unnecessary overhead and degrade performance.
1 2{ "issueId": string, "projectId": string, "changes":[{ "changeType": "updated" | "commented", "atlassianId": string }] }
Property | Description |
---|---|
issueId | ID of the issue the app is rendered on. |
projectId | ID of the project the issue belongs to. |
changes | List of issue changes
|
Rate this page: