Interception
6.9.0The Interception API enables apps to register interception handlers with which to modify the low-level platform operations. Interception handlers can be executed before and/or after the default implementations of the platform operations, and the execution of the default implementation for a platform operation can be prevented entirely. This allows for finer control over the platform operations. It's possible to register only a single interception handler per platform operation within an API domain.
For an app to be able to register interception handlers, interception must be enabled in the system configuration of io.Connect Desktop.
Available since io.Connect Desktop 9.6.
APIobject
Description
Interception API.
Available since version io.Connect Desktop 9.6Methods
registermethod
Signature
(config: InterceptionRegistrationConfig) => Promise<void>
Description
Registers an interception handler. It's possible to register only a single interception handler per platform operation within an API domain.
Parameters
Name | Type | Required | Description |
---|---|---|---|
config | InterceptionRegistrationConfig | Object containing the interception handler to register and settings describing the platform operations to intercept. |
unregistermethod
Signature
(config: InterceptionUnregistrationConfig) => Promise<void>
Description
Unregisters all interception handlers for the specified platform operations.
Parameters
Name | Type | Required | Description |
---|---|---|---|
config | InterceptionUnregistrationConfig | Object specifying the platform operations which to stop intercepting. |
Interceptionobject
Description
Describes a platform operation to intercept and provides settings for its interception.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
domain | string | io.Connect API domain of the platform operation. |
||
operation | string | Name of the io.Connect platform operation within the specified io.Connect API domain.
Set to |
||
phase | "all" | "before" | "after" | Specifies whether to intercept the platform operation before or after the execution of its default implementation.
Set to |
InterceptionMessageobject
Description
Describes an intercepted platform operation.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
callerId | string | ID of the app that has invoked the platform operation. Can be used for tracking purposes. |
||
domain | string | The io.Connect API domain in which the platform operation has been intercepted. |
||
operation | string | The io.Connect platform operation that has been intercepted. |
||
operationArgs | any[] | In the |
||
phase | "before" | "after" | Specifies whether the platform operation has been intercepted before or after the execution of its default implementation. |
InterceptionRegistrationConfigobject
Description
Settings for registering an interception handler for the targeted platform operations.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
handler | (message: InterceptionMessage) => Promise<void | InterceptionResponse> | Method implementation to be registered as a handler for the specified platform operations. It's possible to register only a single interception handler per platform operation within an API domain. |
||
interceptions | Interception[] | List of objects each describing a platform operation to intercept. |
InterceptionResponseobject
Description
Describes the response returned by an interception handler.
If the platform operation has been intercepted before the execution of its default implementation and the interception handler returns undefined
or an empty object,
the platform will proceed with the execution of the default operation implementation.
If the platform operation has been intercepted after the execution of its default implementation and the interception handler returns undefined
or an empty object,
the platform will return the already calculated result.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
operationArgs | any[] | Arguments with which to proceed the execution of the intercepted platform operation. This property is taken into account only when the platform operation is intercepted before the execution of its default implementation. |
||
operationResult | any | Result from the platform operation. Use this property to return a result from your interception handler when the platform operation has been intercepted after the execution of its default implementation. If the platform operation has been intercepted before the execution of its default implementation and this property is set, the execution of the default implementation will be prevented and the platform will return the specified result. |
InterceptionUnregistrationConfigobject
Description
Settings for unregistering the interception handlers for the targeted platform operations.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
interceptions | Interception[] | List of objects each describing a platform operation which to stop intercepting. |