Skip to main content
Access via:io.intents

Intents API.

9 Methods

all()⚓︎

() => Promise<Intent[]>

Returns all registered Intent.

Returns

Promise that resolves with all registered intents.

clearSavedHandlers()⚓︎

() => Promise<void>

Removes all saved Intent handlers for previously raised Intents.

filterHandlers()⚓︎

(handlerFilter: HandlerFilter) => Promise<FilterHandlersResult>

Filters Intent handlers by specified criteria. If there are more than one valid Intent handlers and the Intents Resolver UI is enabled, it will open and display the available handlers.

Parameters (1)

Name Type Required Description
handlerFilter⚓︎ HandlerFilter

Filter for the list of Intent handlers to return.

find()⚓︎

(intentFilter?: string | IntentFilter) => Promise<Intent[]>

Searches for registered intents.

Parameters (1)

Name Type Required Description
intentFilter⚓︎ string | IntentFilter x

can be the intent name or a IntentFilter filtering criteria.

Returns

Promise that resolves with the found intents that match the provided filtering criteria.

getIntents()⚓︎

(handler: IntentHandler) => Promise<GetIntentsResult>

Retrieves all Intents associated with an Intent handler.

Parameters (1)

Name Type Required Description
handler⚓︎ IntentHandler

Intent handler whose Intents to retrieve.

onHandlerAdded()⚓︎

(callback: (handler: IntentHandler, intentName: string) => void) => UnsubscribeFunction

Notifies when a handler for an Intent is added. Returns an unsubscribe function.

io.Connect Browser 3.5

Parameters (1)

Name Type Required Description
callback⚓︎ (handler: IntentHandler, intentName: string) => void

Callback function for handling the event. Receives an object describing the added Intent handler as an argument.

onHandlerRemoved()⚓︎

(callback: (handler: IntentHandler, intentName: string) => void) => UnsubscribeFunction

Notifies when a handler for an Intent is removed. Returns an unsubscribe function.

io.Connect Browser 3.5

Parameters (1)

Name Type Required Description
callback⚓︎ (handler: IntentHandler, intentName: string) => void

Callback function for handling the event. Receives an object describing the removed Intent handler as an argument.

raise()⚓︎

(request: string | IntentRequest) => Promise<IntentResult>

Raises an intent, optionally passing context to the intent handlers, and optionally targeting specific intent handlers. If no handlers are matching the targeting conditions the promise will be rejected.

Parameters (1)

Name Type Required Description
request⚓︎ string | IntentRequest

can be the intent's name or an IntentRequest object carrying the intent, and its optional target, context and start options (see "startNew").

Returns

Promise that resolves with IntentResult.

register()⚓︎

(intent: string | AddIntentListenerRequest, handler: (context: IntentContext, caller?: Instance) => any) => Promise<{ unsubscribe: UnsubscribeFunction }>

If your application is an intent handler use this method to handle incoming intent requests. Please note that when a new instance of your application is started as a result of a raised intent with e.g. startNew your application needs to call register() on startup so that the intent can be resolved. The handler callback will be invoked whenever an intent is raised and your app was selected as an IntentTarget. You can also use this method to register new dynamic intents, that will have the the same lifespan as your application instance.

Parameters (2)

Name Type Required Description
intent⚓︎ string | AddIntentListenerRequest

The intent to be handled. The intent name of an object containing the intent, contextTypes that the intent can handle and a display name.

handler⚓︎ (context: IntentContext, caller?: Instance) => any

The callback that will handle a raised intent. Will be called with an IntentContext if it is provided by the raising application and caller - the Interop Instance which raised the intent.

Returns

Promise that resolves to an object with an unsubscribe function under the unsubscribe property.