Tutorial: fdc3.raiseIntent

fdc3.raiseIntent

Raises a specific intent. It returns a Promise that resolves with an IntentResolution. Due to this being a deprecated behavior in FDC3, it will always return the source and version properties as null.

When specifying a target app, this will be added as metadata to the intent. It can then be accessed by the app provider using InteropBroker.handleFiredIntent.

Example

tickerElement.on('click', (element) => {
    const ticker = element.innerText;
    const context = { type: 'fdc3.instrument', id: { ticker } };

    fdc3.raiseIntent('ViewChart', context);
})

// Passing in a target app
tickerElement.on('click', (element) => {
    const ticker = element.innerText;
    const context = { type: 'fdc3.instrument', id: { ticker } };

    fdc3.raiseIntent('ViewChart', context, 'skype');

    // The shape of the intent that will then come in through InteropBroker.handleFiredIntent will be:
    {
        name: 'ViewChart',
        context: { type: 'fdc3.instrument', id: { ticker } },
        metadata: { fdc3TargetApp: 'skype' }
    }
})