Tutorial: fdc3v2.raiseIntentForContext

fdc3v2.raiseIntentForContext

Finds and raises an intent against a target app based purely on context data. To resolve this into an IntentResolution, the function handleFiredIntentByContext is meant to be overridden in the Interop Broker.

Example

tickerElement.on('click', async (element) => {
    const ticker = element.innerText;

    const context = { 
        type: 'fdc3.instrument', 
        id: { 
            ticker 
        }
    }

    const intentResolution = await fdc3.raiseIntentForContext(context);
})

For FDC3 2.0 the IntentResolution will look like this:

{
    source: {
        appId: 'openfin-app',
        instanceId: 'R56Y12N0567'
    },
    intent: string,
    version: '2.0',
    getResult: (): Promise<IntentResult> => {}
}

When calling getResult, if the application that is intended to handle the Intent has not setup an IntentHandler yet, the Promise will stay pending. Whenever the the IntentHandler returns the IntentResult Promise will resolve.