For now we depicted cases of information flow from the host page to the drugstone component ({{"<"}}drugst-one{{">"}}).
To communicate some information from Drugst.One to your host page, if requested, we emit events that can be listened to. This is generally achieved by adding an EventListener to the component: We select the component by its id (here 'drugstone-component-id') and add the necessary EventListener where "$eventName" has to be replaced with one of the events specified below. In this example we just want the received content to be printed into the browsers console, but this call may be replaced by any custom code, handling the event data.
In the following the specific events will be covered, including the necessary eventName to listen to, as well as how the result object is structured. Also some use-cases for the received object might be proposed here.

Task creation ("taskEvent")

Task IDs are emitted when algorithms are applied to subnetworks. This happens both for module and drug analysis. These tasks are tracked internally but for general result tracking reasons from a hosts perspective it can be necessary to acquire them. The event.detail object, your callback function receives is structured like follows: The taskId can be used to tell drugstone programmatically to load a specific result. For this similar to the id, config or network attributes an additional one (task-id) can be set. It accepts the id of a successfully finished task. Example where the taskId from the received object is set is shown below: or TODO: additional info on how to get status of task using the token with {{api}}