Class: fdc3v2

fdc3v2

The FDC3 Client Library provides a set APIs to be used for FDC3 compliance, while using our Interop API under the hood. In order to use this set of APIs you will need to set up your own InteropBroker or use a Platform application, which does the setup for you. Refer to our documentation on our Interop API.

To enable the FDC3 APIs in a Window or View, add the fdc3InteropApi property to its options:

{
    autoShow: false,
    saveWindowState: true,
    url: 'https://openfin.co',
    fdc3InteropApi: '2.0'
}

If using a Platform application, you can set this property in defaultWindowOptions and defaultViewOptions.

In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:

function fdc3Action() {
    // Make some fdc3 API calls here
}

if (window.fdc3) {
   fdc3Action();
} else {
   window.addEventListener('fdc3Ready', fdc3Action);
}
Version:
  • 2.0

Methods

(async) addContextListener(contextType, handler) → {Listener}

Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass null for the contextType argument.

Parameters:
Name Type Description
contextType string | null
handler ContextHandler(2)
Tutorials:
Returns:
Type
Listener

(async) addIntentListener(intent, handler) → {Promise.<Listener>}

Adds a listener for incoming intents.

Parameters:
Name Type Description
intent string

Name of the Intent

handler IntentHandler(2)

A callback that handles a context event and may return a promise of a Context or Channel object to be returned to the application that raised the intent.

Tutorials:
Returns:
Type
Promise.<Listener>

(async) broadcast(context) → {Promise.<void>}

Broadcasts a context for the channel of the current entity.

Parameters:
Name Type Description
context Context

New context to set.

Tutorials:
Returns:
Type
Promise.<void>

(async) createPrivateChannel() → {Promise.<PrivateChannel>}

Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.

Tutorials:
Returns:
Type
Promise.<PrivateChannel>

(async) findInstances(app) → {Promise.<Array.<AppIdentifier>>}

Find all the available instances for a particular application.

Parameters:
Name Type Description
app AppIdentifier
Tutorials:
Returns:
Type
Promise.<Array.<AppIdentifier>>

(async) findIntent(intent, contextopt, resultTypeopt) → {Promise.<AppIntent(2)>}

Find out more information about a particular intent by passing its name, and optionally its context and resultType.

Parameters:
Name Type Attributes Description
intent string

Name of the Intent

context Context <optional>

Context

resultType string <optional>

The type of result returned for any intent specified during resolution.

Tutorials:
Returns:
Type
Promise.<AppIntent(2)>

(async) findIntentsByContext(context, resultTypeopt) → {Promise.<Array.<AppIntent(2)>>}

Find all the available intents for a particular context.

Parameters:
Name Type Attributes Description
context Context
resultType string <optional>

The type of result returned for any intent specified during resolution.

Tutorials:
Returns:
Type
Promise.<Array.<AppIntent(2)>>

(async) getAppMetadata(app) → {Promise.<AppMetadata(2)>}

Retrieves the AppMetadata for an AppIdentifier, which provides additional metadata (such as icons, a title and description) from the App Directory record for the application, that may be used for display purposes.

Parameters:
Name Type Description
app AppIdentifier
Tutorials:
Returns:
Type
Promise.<AppMetadata(2)>

(async) getCurrentChannel() → {Promise.<(FDC3.Channel|null)>}

Returns the Channel object for the current User channel membership

Tutorials:
Returns:
Type
Promise.<(FDC3.Channel|null)>

(async) getInfo() → {Promise.<ImplementationMetadata(2)>}

Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent. fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.

Tutorials:
Returns:
Type
Promise.<ImplementationMetadata(2)>

(async) getOrCreateChannel(channelId) → {Promise.<Channel>}

Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.

Parameters:
Name Type Description
channelId
Tutorials:
Returns:
Type
Promise.<Channel>

(async) getSystemChannels() → {Promise.<Array.<Channel>>}

Retrieves a list of the User Channels available for the app to join.

Deprecated:
  • Please use fdc3.getUserChannels instead
Tutorials:
Returns:
Type
Promise.<Array.<Channel>>

(async) getUserChannels() → {Promise.<Array.<Channel>>}

Retrieves a list of the User Channels available for the app to join.

Tutorials:
Returns:
Type
Promise.<Array.<Channel>>

(async) joinChannel(channelId) → {Promise.<void>}

Join an app to a specified User channel.

Parameters:
Name Type Description
channelId string

Channel name

Deprecated:
  • Please use fdc3.joinUserChannel instead
Tutorials:
Returns:
Type
Promise.<void>

(async) joinUserChannel(channelId) → {Promise.<void>}

Join an app to a specified User channel.

Parameters:
Name Type Description
channelId string

Channel name

Tutorials:
Returns:
Type
Promise.<void>

(async) leaveCurrentChannel() → {Promise.<void>}

Removes the app from any User channel membership.

Tutorials:
Returns:
Type
Promise.<void>

(async) open(app, contextopt) → {Promise.<AppIdentifier>}

Launches an app, specified via an AppIdentifier object.

Parameters:
Name Type Attributes Description
app AppIdentifier | TargetApp
context Context <optional>
Tutorials:
Returns:
Type
Promise.<AppIdentifier>

(async) raiseIntent(intent, context, appopt) → {Promise.<IntentResolution(2)>}

Raises a specific intent for resolution against apps registered with the desktop agent.

Parameters:
Name Type Attributes Description
intent string

Name of the Intent

context Context

Context associated with the Intent

app AppIdentifier | TargetApp <optional>
Tutorials:
Returns:
Type
Promise.<IntentResolution(2)>

(async) raiseIntentForContext(context, appopt) → {Promise.<IntentResolution(2)>}

Finds and raises an intent against apps registered with the desktop agent based purely on the type of the context data.

Parameters:
Name Type Attributes Description
context Context

Context associated with the Intent

app AppIdentifier | TargetApp <optional>
Tutorials:
Returns:
Type
Promise.<IntentResolution(2)>