# Flow API The functions here are designed to warn add-on packages about the different states of the simulation flow and the potential [FLT files](../../../content-configuration/flt-files/flt-file-properties/) that are loaded. The Flow API is a "global" API that is mainly used to deal with [Back On Track](../../../content-configuration/flt-files/back-on-track/) events, and it is available across the following platforms: - [WebAssembly](../../wasm/webassembly/) - [JavaScript](../javascript/) - [SimConnect SDK](../../simconnect/simconnect-api-reference/#flow) You can find a sample project to use as a reference when using the Flow API here: - [FlowAircraft](../../../samples-tutorials/samples/simobjects-aircraft/modularaircraft/flowaircraft/) There are also debugging tools available in DevMode which can be used to help debug Flow Events and API events, which is described on the following page: - [Global API Debugging](../../../devmode/menus/debug_info/debug-platform-dispatcher/) ### Using The Flow API To receive flow event from the simulation, you must follow the steps outlined below: 1. Register the listener in the JavaScript code: ``` js this.platformDispatcherListener = RegisterViewListener('JS_LISTENER_COMM_BUS'); // or this.platformDispatcherListener = RegisterCommBusListener(() => { ... }); ```   2.  Create a callback which will be used when a flow event is received: ``` js ReceiveEvent(dataStr) { var data = JSON.parse(dataStr); // dataStr is a json which respects the format : // { "event" : id_of_the_event, "flt_path" : "path_of_the_flt" } } ``` The data string that is sent requires the following two data-points: {{< table-wrapper >}} | Parameters | Description | |-------------------|-------------------------------------------------------------------------------------------------------------| | `id_of_the_event` | The ID of a flow event that follows the enum defined in [FsFlowEvent](../../wasm/flow-api/fsflowevent/). | | `path_of_the_flt` | The VFS path of a potential FLT file loaded with the event received. | {{< /table-wrapper >}}   3. Finally you need to register the corresponding `__FLOW_API__ ` to call the callback on Event: ``` js this.platformDispatcherListener.on("__FLOW_API__", this.ReceiveEvent); ```