Skip to main content

FDC3 intent listener

This is a utility element that listens to any raised intents in FDC3 that are handled by the application.

Use cases:

  • Handle intents raised against an application in an FDC3 workspace.

Examples

This handles intents raised against the application.

Compatibilty with Desktop Agent implementations

Where an app is intended to be launched in order to resolve a raised intent, the element must be present in the DOM within 15 seconds of the application launch.

This is the minimum timeout that Desktop Agents are required to provide in order to be widely compatible with Desktop Agent implementations

Declaration

<fdc3-intent-listener></fdc3-intent-listener>

Usage

@customElement({
name: 'my-element',
template: html`
<div>Instrument message:<i>${x => x.instrumentMessage}</i></div>
<div>Quote message:<i>${x => x.quoteMessage}</i></div>
<fdc3-intent-listener
:config="${(x) => [
{
intent: 'ViewInstrument',
callback: (message) => x.handleInstrumentMessage(message),
},
{
intent: 'ViewQuote',
callback: (message) => x.handleQuote(message),
},
]}"
>
</fdc3-intent-listener>
`,
})
export class MyElement extends GenesisElement {

@observable quoteMessage: any = {};

@observable instrumentMessage: any = {};

handleQuoteMessage(message) {
this.quoteMessage = JSON.stringify(message);
}

handleInstrumentMessage(message) {
this.instrumentMessage = JSON.stringify(message)
}
}

DOM API

Property and attribute binding examples for Genesis Component syntax. Closing tag omitted.

Attributes

This component has no attributes

Properties

PropertyTypeUseExample
configIntentConfigAn array of objects which configure the intent name and a handler for intent payloads
<fdc3-intent-listener :config=${() =>
[{ intent: 'ViewInstrument', callback: (msg) => console.log(JSON.stringify(msg)}]
}>